该如何把获取到微信头像放到云存储中去?

发布于 7 年前作者 wei949681 次浏览最后编辑 7 年前来自 issues

使用wx.cloud.uploadFile()一直报错

VM2013 WAService.js:2 Unhandled promise rejection Error: cloud.uploadFile:fail undefined . uploadFile:fail createUploadTask:fail file not found

  wx.getUserProfile({

      desc: ‘用于发布动态’,

      success: (res) => {

        console.log(res);

        console.log(res.userInfo);

        wx.cloud.uploadFile({

          cloudPath: ‘userImage/’ + util.getRandName() + ‘.jpg’,

          filePath: res.userInfo.avatarUrl

        }).then(res => {

          console.log(‘用户头像保存成功’);

        })

      },

3 回复
yejing
yejing1 楼4 年前

为啥都不

pingma
pingma2 楼4 年前

需要先下载到本地,然后上传的时候用临时路径,不能直接用网络路径。

qfu
qfu3 楼4 年前

为什么不保存url即可?