框架类型 | 问题类型 | 终端类型 | AppID | 环境ID | 基础库版本 |
---|---|---|---|---|---|
小程序 | Bug | 微信iOS客户端 | wx98c42fdd3aa5cf5e | cloud1-3gf2g21v4e8ed368 | 2.10.4 |
用wx.chooseMessageFile上传聊天界面的文件,真机的时候返回的path是wx:file开头,
用wx.downloadFile下载报错downloadFile:fail url scheme is invalid
但是用开发者工具的时候返回的是http开头,是可以下载
1是上传方法,2是下载方法
1、wx.chooseMessageFile({
count: 3,
type: 'file',
success(res) {
this.setState({
path: res.tempFiles,
});
}
})
2、wx.downloadFile({
url: path,
success (res) {
wx.openDocument({
filePath: res.tempFilePath,
success: function (res) {
wx.hideLoading()
}
})
}
})
网友回复
Mr.Zhao:
wx:file 这种路径就不应该下载,这是微信客户端的协议。直接open就行了,不用下载