【发布时间】:2014-02-12 06:08:59
【问题描述】:
我在尝试将照片插入数据库时遇到上述错误。奇怪的是文档的文件端插入得很好,但没有任何东西插入到块端。我环顾了网络,但没有得到任何关于问题可能是什么的提示。有没有人看到这个错误并可以提供帮助?
这是我的代码。
collections.js
PhotosFS = new CollectionFS('photos');
PhotosFS.allow({
insert: function (userId, file) {
return userId && file.owner === userId;
}
});
events.js
Template.createPhotos.events({
"change input[type='file']": function (e, tmpl) {
var file = e.target.files;
Session.set('currentFile', file[0]);
},
"click .save-button": function (e, tmpl) {
var file = Session.get('currentFile');
PhotosFS.storeFile(file, {
name: name,
photographer: photographer,
caption: caption,
});
}
});
【问题讨论】:
标签: meteor