[已解决]api不返回任何提示
发布于 5 年前 作者 caichao 13313 次浏览 来自 问答

API是wx.cloud.uploadFile

url传的是.takePhoto()方法获取的照片临时地址wxfile://xxxxxxxxxx.jpg

但是wx.cloud.uploadFile()方法没有执行,成功/失败/完成都没有返回值,这是为什么呢?

updatePhoto(url) {
    console.log(`上传图片地址:${url}`)
    let random = Date.parse(new Date()) + Math.ceil(Math.random() * 1000)
    wx.cloud.uploadFile({
        cloudPath: `etman/${random}.png`,
        filePath: url, // 文件路径
        success: res => {
            // get resource ID
            console.log(res)
        },
        fail: err => {
            // handle error
            console.log(err)
        },
        complete: res => {
            console.log(res)
        }
    })
}
1 回复

let filePath = url

let random = Date.parse(new Date()) + Math.ceil(Math.random() * 1000)

let cloudPath =  `etman/${random}.png`

wx.cloud.uploadFile({

cloudPath,

filePath,

success: res => {

console.log(’[上传文件] 成功:’, res)

},

fail: e => {

console.error(’[上传文件] 失败:’, e)

},

complete: () => {

}

})

回到顶部