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

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

2023-09-17 17:48| 来源: 网络整理| 查看: 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 实验室设备网 版权所有