downloadfile下载的文件缺少扩展名
问题描述:
本人使用 hotapp 作为 https 代理访问 http 图片资源,但发现文件是能够正确下载,就是下载后savefile 保存的文件扩展名是没有的。
具体代码如下:
download:function(){ var that =this console.log(" do") wx.downloadFile({ url: 'https://wxapi.hotapp.cn/proxy/?appkey=hotapp174xx4938&url=http://oqjg4mec3.bkt.clouddn.com/file01.jpg', success: function (res) { var hellopath = res.tempFilePath console.log(res.tempFilePath) wx.saveFile({ tempFilePath : hellopath, success: function (res) { var savedPath = res.savedFilePath console.log("保存在:"+savedPath) } }) }, fail:function(){ console.log("fail") } }) }, |
下载后的文件如图:
手动修改文件增加扩展名“.jpg”之后,文件可以正常使用。请问各位技术朋友,这是为什么?
注:以上链接如果放到浏览器中,可以正确下载到文件。
