【发布时间】:2015-11-05 06:20:21
【问题描述】:
从标题中可以看出,在删除不安全的包后,我的 Collection FS 出现问题。
我正在使用 cfs:gridfs。
删除包:不安全、自动发布
我的 HTML
<template name="image_upload">
<input class="fileinput btn" type="file" name="file" accept="image/*" {{disableButton}}>
</template>
在我的服务器 Publications.js 中
Meteor.publish("image_upload", function () {
return Images.find();
});
我的库/collections.js
Images = new FS.Collection("images", {
stores: [
new FS.Store.GridFS("images"),
],
filter: {
allow: {
contentTypes: ['image/*']
}
}
});
Images.deny({
insert : function() {return false},
update : function() {return false},
remove : function() {return false},
// insert : function() {return false},
});
Images.allow({
insert: function() { return true },
update: function() { return true },
remove: function() { return true }
});
还有我的图片上传活动
Template.image_upload.events({
'change .fileinput': function(event, template){
// console.log('abs');
var username = Meteor.user().username;
FS.Utility.eachFile(event, function(file){
var fsFile = new FS.File(file);
fsFile.username = username;
fsFile.tweetkey = Session.get('tweetkey');
Images.insert(fsFile, function(err) {});
});
}
});
我的包裹
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-platform
accounts-ui
accounts-password
msavin:mongol
cfs:standard-packages
cfs:gridfs
iron:router
mizzao:jquery-ui
mizzao:bootstrap-3
fortawesome:fontawesome
reywood:publish-composite
momentjs:moment
如果有人可以帮助我,那就太好了!
【问题讨论】:
-
您收到了哪些错误消息?
-
@Curtis 没有错误消息...顺便说一句,我删除了插件自动发布
标签: templates meteor collections insert fs