为什么手机下载的文件却丢了扩展名?
在做文件的上传下载时,要采用 downloadfile 这个小程序API。以下是我的代码:
[JavaScript] 纯文本查看 复制代码 ? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | download: function (){
wx.downloadFile({
url: 'https://wokao666.club/examples/2.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)
wx.showToast({
title: '成功' ,
icon: 'success' ,
duration: 2000
})
}
})
},
fail: function () {
console.log( "fail" )
}
})
},
|
在电脑端开发工具上进行调试,可以成功下载到文件,并且文件扩展名是存在的。
可是在手机上预览时,下载的文件的扩展名是没有的。
具体如下图:
|
请问问题解决了我,我也遇到同样的问题