在ios 上传图片报错
这个是报错信息
contact.js? [sm]:72 [上传图片] 失败: Error: errCode: -503002 storage permission denied | errMsg: Have no access right to the storage
at new u (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:263087)
at Function.success (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:401959)
at h (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:120991)
at Object.eval [as success] (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:121816)
at y (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:600031)
at b (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:600269)
at eval (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:601645)
at Object.u (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:77760)
at runtime.js?devtools_ignore=true:1
at Z (runtime.js?devtools_ignore=true:1)
下面是源代码
doUpload: function () {
// 选择图片
wx.chooseImage({
count: 1,
sizeType: ['original','compressed'],
sourceType: ['album', 'camera'],
success: res => {
wx.showLoading({
title: '上传中',
})
const filePath = res.tempFilePaths[0]
// 上传图片
const cloudPath = 'my-image' + filePath.match(/\.[^.]+?$/)[0]
wx.cloud.uploadFile({
cloudPath,
filePath,
success: res => {
console.log('[上传文件] 成功:', res, filePath)
$wuxToast().show({
type: 'success',
text: '上传图片成功',
color: '#fff',
duration: 2000
});
this.setData({
imagePath: filePath
})
},
fail: e => {
console.error('[上传图片] 失败:', e)
$wuxToast().show({
type: 'forbidden',
text: '上传图片失败',
color: '#fff',
duration: 2000
});
},
complete: () => {
wx.hideLoading()
}
})
},
fail: e => {
console.error(e)
}
})
},
是安卓先上传的吧