jjzjj

FileName

全部标签

javascript - Angular 获取图像数据并再次将其附加到 FormData

在Angular5中,我通过我的服务从mongodb获取hotelgallery的图像。所以基本上我得到的数据是这样的{fieldname:"hotelgallery",originalname:"e.jpg",encoding:"7bit",mimetype:"image/jpeg",destination:"./public/",encoding:"7bit",filename:"1521139307413.jpg"mimetype:"image/jpeg"path:"public/1521139307413.jpg"size:66474}{fieldname:"hotelgall

javascript - 保存图像 Blob

我有一个函数可以让我传递文件内容、名称和类型,该函数会自动保存它。它适用于基于文本的文档,但现在我正试图让它保存其他文件,如图像文件。沿线的某个地方它被损坏并且无法正常工作。functionwrite(text,filename,mime){varfile=newBlob([text],{type:mime}),a=document.createElement('a');//DownloadinIEif(window.navigator.msSaveBlob)window.navigator.msSaveBlob(file,filename);//Downloadincompliant

javascript - Openlayers 根据您的 map 编写并保存 KML

是否可以从OpenLayers编写和保存KML?有人知道导出一个的例子吗? 最佳答案 您只能将矢量要素导出到KML。functionGetKMLFromFeatures(features){varformat=newOpenLayers.Format.KML({'maxDepth':10,'extractStyles':true,'internalProjection':map.baseLayer.projection,'externalProjection':newOpenLayers.Projection("EPSG:4326"

javascript - 匹配来自单个正则表达式的文件名和文件扩展名

我确信这一定很容易,但我正在努力...varregexFileName=/[^\\]*$/;//matchfilenamevarregexFileExtension=/(\w+)$/;//matchfileextensionfunctiondisplayUpload(){varpath=$el.val();//Thisisafileinputvarfilename=path.match(regexFileName);//returnsfilenamevarextension=filename[0].match(regexFileExtension);//returnsextension

javascript - 删除完整路径,仅保留文件名

尝试删除返回到imgurl的完整url:通常返回类似http://localhost/wordpress/wp-content/uploads/filename.jpg的内容或http://localhost/wordpress/wp-content/uploads/images/filename.jpg我想剥离除filename.jpg之外的所有内容并将其返回给ahng_photos_upload_image。剥离所有内容直到最后一个正斜杠。我如何使用Jquery做到这一点?window.send_to_editor=function(html){imgurl=jQuery('img

javascript - Node JS/Gzip : Image file download ends prematurely with no error

我正在Node.js中创建一个应用程序来下载图像文件。但是,我一直遇到一个问题,如果我的下载速度很慢或者我失去连接,我正在下载的图像将是truncated。.如果我的程序抛出一个错误警告我图片没有完成下载,这并没有那么糟糕,但是,它并没有像图片下载成功一样解析。下载后检查响应代码或探测图像时没有收到错误。这是我用来下载图片的当前代码。constfs=require('fs-extra');constrequest=require('request');varprobe=require('probe-image-size');varprogress=require('request-pr

javascript - 将变量传递给javascript中的异步函数( promise )

我有以下循环运行的代码:varindex=fileNames[x].lastIndexOf("/")+1;varcurrentImageName=fileNames[x].substr(index);if(currentImageName.indexOf(".jpg")!=-1){reader.getFileAsBlob(fileNames[x]).done(function(blob){picturesFilePathArray.push({fileName:currentImageName,fileURL:blobURL(blob)});refreshKMZList();});}我

javascript - react native v0.56 : Cannot read property 'filename' of undefined at PluginPass. JSXOpeningElement

我刚刚将ReactNative从0.55更新到0.56。但是,当我尝试运行代码(react-nativerun-android或run-ios)时,捆绑停止到这一点:Loadingdependencygraph,done.error:bundlingfailed:TypeError:Cannotreadproperty'filename'ofundefinedatPluginPass.JSXOpeningElement({path_to_my_project}/react-native/node_modules/babel-plugin-transform-react-jsx-sour

javascript - 在 Asp.Net Core 中使用 Ajax 上传文件

大家好我正在尝试使用ajax从客户端上传文件到服务器端(asp.netcore)Controller,但我有一个空值。这是我的html和javascript代码:functionuploadcsvfile(){varmyfile=document.getElementById("myfile");varformData=newFormData();if(myfile.files.length>0){for(vari=0;i这是我使用IFormFile的ControllerpublicasyncTaskUploadFile(IFormFileformData){//dosomething

Javascript 正则表达式在 IE 中失败,但在 Chrome 和 Edge 中工作

我试图在javascript中使用正则表达式替换文件名中的非法字符,但它在IE11中不断失败,出现“正则表达式中的语法错误”。相同的代码在Chrome和Edge中运行良好。String.prototype.replaceAll=function(search,replacement){vartarget=this;returntarget.replace(search,replacement);};varfilename='test+&+this+again.2016.txt';filename=filename.replaceAll(newRegExp(/[^a-zA-Z0-9_\-