当前位置:   article > 正文

微信小程序 下载文件到本地 (解决文件名乱码问题)_微信下载图片名字乱码

微信下载图片名字乱码
 function loadfile(data){
    let url = data.file_url
    let fileName =data.title;
    wx.showLoading({
      title: '正在打开文件'
    })
  const manage = wx.getFileSystemManager();
  wx.downloadFile({
    url: url,
    success (res) {
      var savePath = wx.env.USER_DATA_PATH + "/" + fileName
      if (res.statusCode == 200) {
        manage.saveFile({
          tempFilePath: res.tempFilePath,
          filePath: savePath+'.docx',
          success:function(res){
            wx.openDocument({
               filePath: res.savedFilePath,
               success: function (res) {
               wx.hideLoading()
               }
             })
          }
        })
      }
    }
  })
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/828854
推荐阅读
相关标签
  

闽ICP备14008679号