- 为什么更换新套餐无法提交订单?
一直提示校验失败 [图片]
2022-08-30 - 云端调用cloud.uploadFile把文件上传到微信小程序官方云存储时,报TypeError
从别的接口接收到base64编码的图像,想在云端以base64作为encoding保存为文件后,读取该文件并上传到云存储,在上传时报告了异常: errCode: -1errMsg: "uploadFile:fail TypeError: Cannot destructure property `url` of 'undefined' or 'null'.; at uploadFile api; "相关代码: const fs = require('fs') const path = require('path') const cloud = require('wx-server-sdk') //文件上传函数 function upload_res_file(options) { fs.writeFileSync(path.join(__dirname, 'demo.jpg'), options.fileContent, { encoding: 'base64', mode: 0o777 }); const file_content = fs.createReadStream(path.join(__dirname, 'demo.jpg')); cloud.uploadFile({ cloudPath: options.cloudPath + '.jpg', fileContent: file_content, }).then(options.success).catch(options.fail); }
2020-09-23