收藏
回答

wx.downloadFile无法成功下载?

  1. 安卓机型可以成功下载
  2. IOS无法下载
  3. 开发工具无法完成下载

报错信息: downloadFile:fail Error:Parse Error

回答关注问题邀请回答
收藏

4 个回答

  • 全媒体(广告-网站-公众号-小程序)
    全媒体(广告-网站-公众号-小程序)
    2021-12-28

    我的代码一样的没有另存为按钮,最后解决了吗?

    2021-12-28
    有用
    回复
  • 我是马超的腾讯网友
    我是马超的腾讯网友
    2020-09-21

    wx.showLoading({ title: '下载中', mask:true })

    //先下载,再打开

    wx.downloadFile({

    url: url,

    header: "application/json",

    success: function (res) {

    wx.showLoading({ title: '打开中', mask:true })

    let filePath = res.tempFilePath

    console.log("文件临时路径",res.tempFilePath)

    let type = res.tempFilePath.slice(res.tempFilePath.lastIndexOf(".")+1)

    console.log("文件type",type)

    that.fileCacheMap.set(url, filePath);

    //打开文档

    wx.openDocument({

    filePath: filePath,

    fileType: type,

    success: function (res) { },

    complete: function (res) {

    wx.hideLoading()

    }

    })

    },

    fail: function(res){

    console.log("fail-res",res)

    //打印如下: errMsg: "downloadFile:fail Error: Parse Error"

    },

    complete: function (res) {

    wx.hideLoading()

    }

    })




    2020-09-21
    有用
    回复
  • Cjiang
    Cjiang
    2020-09-18

    你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    2020-09-18
    有用
    回复
  • Admin ²º²³
    Admin ²º²³
    2020-09-18

    建议最好代码片段写一个吧。

    2020-09-18
    有用
    回复 2
    • 我是马超的腾讯网友
      我是马超的腾讯网友
      2020-09-21
      wx.showLoading({ title: '下载中', mask:true })


      //先下载,再打开


      wx.downloadFile({


      url: url,


      header: "application/json",


      success: function (res) {


      wx.showLoading({ title: '打开中', mask:true })


      let filePath = res.tempFilePath


      console.log("文件临时路径",res.tempFilePath)


      let type = res.tempFilePath.slice(res.tempFilePath.lastIndexOf(".")+1)


      console.log("文件type",type)


      that.fileCacheMap.set(url, filePath);


      //打开文档


      wx.openDocument({


      filePath: filePath,


      fileType: type,


      success: function (res) { },


      complete: function (res) {


      wx.hideLoading()


      }


      })


      },


      fail: function(res){


      console.log("fail-res",res)


      //打印如下: errMsg: "downloadFile:fail Error: Parse Error"


      },


      complete: function (res) {


      wx.hideLoading()


      }


      })
      2020-09-21
      回复
    • Admin ²º²³
      Admin ²º²³
      2020-09-21回复我是马超的腾讯网友
      header: "application/json",

      去掉
      2020-09-21
      回复
登录 后发表内容
问题标签