关于小程序文件下载并保存到本地的功能? |
您所在的位置:网站首页 › wps文件超过10m上传限制 › 关于小程序文件下载并保存到本地的功能? |
目前小程序要做保存excel、pdf等文件的功能, 我调用了wx.downFile,然后再调用saveFile,直接是走进了saveFile的success函数,但是保存的文件去哪里打开呢,还是说这个保存并不是保存到手机上? 还是说,现在的小程序并不支持保存文件到手机上(不是临时保存,是可以在退出小程序后再次在手机中找到并且打开) wx.downloadFile({ url: item.url, // filePath: wx.env.USER_DATA_PATH + '/' + item.fullName, success (res) { if (res.statusCode === 200) { wx.hideLoading() // let tempFilePath = res.filePath // 如果设置了filePath参数,则不会有tempFilePath let tempFilePath = res.tempFilePath wx.saveFile({ tempFilePath, success (res) { // 可以进行到这里 console.log(res); const savedFilePath = res.savedFilePath wx.showToast({ title: '下载成功', icon: 'none', mask: true }) }, fail (err) { console.log(err); wx.showToast({ title: '下载失败,请重新尝试', icon: 'none', mask: true }) } }) } } }) |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |