addImg:function(){
let fsm = wx.getFileSystemManager();
fsm.writeFile({
filePath: wx.env.USER_DATA_PATH + '/tmp.txt',
data: "数据" + rqzh.formatTime(new Date()) + "\n",
encoding: 'base64',
success: res => {
console.log('文件生成',res)
let filepath= wx.env.USER_DATA_PATH + '/tmp.txt'
const cloudPath = "cjdata/" + rqzh.formatTime(new Date())+ ".ccjson"
wx.cloud.uploadFile({
cloudPath: cloudPath,
filePath: filepath,
success: resa => {
console.log('[上传文件] 成功:', resa.fileID)
let fileid=resa.fileID
wx.cloud.downloadFile({
"fileID": fileid,
success: res => {
console.log('文件下在',res)
}
})
}})
云文件已经上传上了,但是下载不了,提示为
- {statusCode: 500, header: {…}, cookies: Array(0), errMsg: "downloadFile:ok"}
- cookies: []errMsg: "downloadFile:ok"header: {}statusCode: 500__proto__: Object
我的文件名字命的有问题,不应该有空格,现在可以了。不知云上为什么可以上传带空格的名字,就是不能下载。谢谢