FileSystemManager.writeFile报错
var imgurl = that.data.imgurl;
let manager = wx.getFileSystemManager()
var savedFilePath = wx.env.USER_DATA_PATH + '/test/test.png';
manager.writeFile({
filePath: savedFilePath,
encoding: imgurl,
sucess: function (res) {
console.log("writeFilesucess res:", res)
},
fail: function (err) {
console.log("writeFile fail err:", err)
},
我写这样的函数报错为writeFile:fail invalid encoding
imgurl为图片base64编码。
求大神给个解答啊,小城市自学狗,身边没有人会,只能求助于你们了,万望帮助
1 回复
var imgurl = that.data.imgurl; let manager = wx.getFileSystemManager() var savedFilePath = wx.env.USER_DATA_PATH + '/test/test.png'; manager.writeFile({ filePath: savedFilePath,
data : imgurl,
encoding:'base64',
sucess: function (res) { console.log("writeFilesucess res:", res) }, fail: function (err) { console.log("writeFile fail err:", err) },