我在服务器端使用ostrio/files,也就是Meteor文件(来自veliovgroup或keenethics),将文件插入到db.images、db.fs.files和db.fs.chunks。我的代码只在db.images中插入一条记录,而在fs.files和fs.chunk中则不插入任何记录。我的代码如下:
Images.write(this.bodyParams.file, {
fileName: 'SignUpTermsAndConditions_' + this.bodyParams.name,
fielId: 'abc123myId', //optional
type: 'application/vnd.oasis.opendocument.text',
meta: {owner: this.userId,createdAt: new Date()}
}, function (error, fileRef) {
if (error) {
throw error;
} else {
console.log(fileRef.name + ' is successfully saved to FS. _id: ' + fileRef._id);
}
});
我可以使用以下代码将客户机中的文件插入到db.images、db.fs.files和db.fs.chunks中:
Images.insert({
file: file, // where var file = e.currentTarget.files[0];
fileName: fileName + e.currentTarget.files[0].name,
onStart: function () {
},
onUploaded: function (error, fileObj) {
if (error) {
alert('Error during upload: ' + error);
} else {
}
},
streams: 'dynamic',
chunkSize: 'dynamic'
});
上面第一个代码段中的服务器代码工作不正常或不符合预期。请提供帮助。
信息:如何设置网格
this link
. 我的images.write as my second code snippet above是根据
this link
. 简而言之,我正在跟踪文档,但我的服务器images.write无法按预期工作。请帮助!