问题描述
我有一个运行 parse-server: 2.8.4
和 parse: 1.11.1
的基本解析服务器。我已将服务器连接到最近使用 appId
和 masterKey
创建的 MongoDB Atlas 集群。
我还使用最新的解析 SDK 创建了一个 angular 应用程序。我为我在 parseService 中发送的文件添加了一个 input
:
async onFileSelected(event: any) {
const id = this.route.snapshot.paramMap.get('id');
const file = event.target.files[0];
this.parse
.uploadPhoto(id,'photo',file)
.then(() => {
console.log('successfully uploaded photo');
})
.catch((err) => {
console.log(err);
});
}
这是 parseService 函数:
async uploadPhoto(id: string,fieldName: string,file: any): Promise<any> {
const parseFile = new Parse.File(file.name,file);
const Landmarks = Parse.Object.extend('Landmarks');
const query = new Parse.Query(Landmarks);
const landmark = await query.get(id);
await parseFile.save();
await landmark.set(fieldName,parseFile);
}
我对解析服务器有其他请求以获取、保存或授权用户,一切正常,但是当我选择一个文件并将其发送为这样保存时。我从服务器收到 400 代码错误和错误消息:error: Could not store file. code=130,message=Could not store file.
我进行了一些研究以找到解决方案,一个常见的问题是数据库中没有剩余空间。我的数据库基本上是空的,仍然有空间,而我试图保存的 jpeg 并没有那么大。我还检查了我的图集集群,似乎即使我收到错误,也有一个名为 fs.chunks
的集合,但是当我检查解析仪表板时,那里什么也没有。
我更喜欢一种解决方案,如果它存在,我不必更改我的解析服务器版本,但任何解决方案都适用于我,如果我遗漏了任何信息,请询问并提供它。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)