使用wafer2 Node.js SDK 上传图片失败
发布于 5 年前 作者 awu 8635 次浏览 来自 问答

data: “{“code”:-1,“error”:”[object Object]"}"  上传图片成功后返回的结构体中没有回调图片地址

报错信息:

报错代码:

wx.chooseImage({

count: 1,

sizeType: [‘compressed’],

sourceType: [‘album’, ‘camera’],

success: function(res){

util.showBusy(‘正在上传’)

var filePath = res.tempFilePaths[0]

// 上传图片

wx.uploadFile({

url: config.service.uploadUrl,

filePath: filePath,

name: ‘file’,

success: function(res){

util.showSuccess(‘上传图片成功’)

console.log(res)

res = JSON.parse(res.data)

console.log(res)

that.setData({

imgUrl: res.data.imgUrl

})

},

回到顶部