如果报错:upload.js? [sm]:46 上传失败 Error: errCode: -503002 storage permission denie
修改一下储存权限
代码:
chooseImg() {
wx.chooseImage({
count: 1,
// 选择图片的数量
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: res => {
// tempFilePath可以作为img标签的src属性显示图片
// const tempFilePaths = res.tempFilePaths,
this.uploadImg(res.tempFilePaths[0])
}
})
},
uploadImg(temFile) {
wx.cloud.uploadFile({
cloudPath: "我是图片.jpg",
filePath: temFile,
success: res => {
console.log("上传成功",res)
},
fail(err) {
console.log("上传失败",err)
}
})
},
网友评论