首页 新闻 会员 周边

小程序的wx.downloadFile的downloadFile:fail downloadFile protocol must be http or https"

0
悬赏园豆:40 [待解决问题]
ViewFile:function(e){
let url = e.currentTarget.dataset.url;
console.log(url);
let that=this;
if (url == undefined || url == null) {
util.showError("参数有误,请和管理员联系!");
return;
}
wx.downloadFile({
url: url,
success(res){
console.log(res);
if(res.statusCode==200){
const tempFilePath=res.tempFilePath
wx.openDocument({
filePath: tempFilePath,
success: function (res) {

        },
        fail:function(res){
          util.showError('打开失败,文件不存在')
        }
      })
    }
  },
 fail:function(res){
   console.log(res);
   util.showError('文件下载失败,请和管理员联系');
 }
})
}

微信小程序下载文件失败
真机res输出信息:downloadFile:fail downloadFile protocol must be http or https"

神奇的是真机调试失败,电脑上是可以的能下载并打开

那些什么域名什么的都已经配置好,是https
我图片能正常上传下载查看,就文件下载时候,手机端不行

ccccc三的主页 ccccc三 | 初学一级 | 园豆:5
提问于:2020-09-26 11:06
< >
分享
所有回答(2)
0

参考一下https://blog.csdn.net/qq_43338177/article/details/104622322看能不能解决你的问题

中控易动 | 园豆:903 (小虾三级) | 2020-10-10 14:45

已解决,谢谢

支持(0) 反对(0) ccccc三 | 园豆:5 (初学一级) | 2020-10-10 15:53
0

路径不能是微信提供的临时路径

ccccc三 | 园豆:5 (初学一级) | 2020-10-10 15:54
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册