https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/userProfile.html
cloud.uploadFile:fail undefined . uploadFile:fail createUploadTask:fail file not found这个报错是什么意思
submit(e) {
const db = wx.cloud.database();
var that = this;
wx.cloud.uploadFile({
cloudPath: 'A' + Math.random() + '.jpg',
filePath: that.data.avatarUrl,
}).then(res => {
console.log('上传成功',res)
console.log('上传成功',res.fileID)
var imgpath = res.fileID;
var name = that.data.nickName;
db.collection('reg')
.add({
data: {
name: that.data.nickName,
imgID: res.fileID
},
success: function (res) {
app.globaData.name = name;
app.globaData.imgpath = imgpath;
wx.showModal({
title: '注册成功',
content: '进入点餐',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
wx.navigateTo({
url: '../index/index',
})
}
}
})
},
fail: function (event) { }
})
}).catch((e) => {
console.log(e);
});
},
你的that.data.avatarUrl是空的