Uniapp cloud storage {“errmsg”: “cloudpath is illegal”}

Upload pictures to cloud storage.

uni.chooseImage({
                    count:1,
                    success:res=>{
                        this.src=res.tempFilePaths[0]
                        console.log(res.tempFilePaths[0])
                        uniCloud.uploadFile({
                            filePath:res.tempFilePaths[0],
                            cloudPath:res.tempFilePaths[0]+res.tempFiles[0].name,
                            success: (res) => {
                                console.log(res)
                            },
                            fail: (err) => {
                                console.log(JSON.stringify(err))
                            }
                        })
                    }
                    
                })

 

Error reported: {errmsg “:” cloudpath is illegal “}

Reason: cloudpath  –  when using alicloud, cloudpath is the cloud file name. Do not use the illegal character

(cloudpath: res.tempfilepaths [0] + res.tempfiles [0]. Name -- & gt; is illegal)

Solution: change to cloudpath: res.tempfiles [0]. Name

 

Similar Posts: