收藏
回答

小程序云开发

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小程序 Bug 微信安卓客户端 wxe7b316353a1938a0 lizhihui-1gnhwjsbb2ed287f 1.06.2312262

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);

    });

  },


回答关注问题邀请回答
收藏

1 个回答

  • showms
    showms
    2023-12-31

    你的that.data.avatarUrl是空的

    2023-12-31
    有用
    回复
登录 后发表内容