uniapp报错:saveFile:fail the maximum size of the file storage limit is exceeded的意思是:
小程序的本地存储已经满了,解决方法:删除本地存储即可。
代码如下:
// 获取本地已保存的文件列表,删除缓存用,否则微信小程序会报缓存已满错误
uni.getSavedFileList({
success: function (res) {
if (res.fileList.length > 0) {
// 删除本地存储的文件
uni.removeSavedFile({
filePath: res.fileList[0].filePath
});
}
}
});与之相似的另一个报错是:XXXX多少M已经满了,解决方法:在微信小程序开发工具清除缓存即可。
另外一个踩坑的问题是:
微信小程序下载的文件路径类似:wxfile://store_543536f534.pdf,仅支持在小程序内使用。
uniapp可用下面3个接口处理:
uni.saveImageToPhotosAlbum
uni.saveVideoToPhotosAlbum
uni.saveFile