choose_img() {
wx.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success (res) {
const tempFilePaths = res.tempFilePaths[0];
if(tempFilePaths) {
var t = new Date().getTime();
wx.cloud.uploadFile({
cloudPath: `example_${t}.png`,
config: {
env: '云环境ID' //未初始化请填写自己云环境 ID,
},
filePath: tempFilePaths
}).then(res => {
console.log(res)
}).catch(error => {
// handle error
})
}
}
})
}
本地资源上传至云存储空间
最新推荐文章于 2024-07-18 15:48:23 发布