关于小程序文件下载并保存到本地的功能?

您所在的位置:网站首页 微云文件保存在哪 关于小程序文件下载并保存到本地的功能?

关于小程序文件下载并保存到本地的功能?

2024-05-31 05:13| 来源: 网络整理| 查看: 265

目前小程序要做保存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 办公设备维修网 版权所有 豫ICP备15022753号-3