我正在使用这些包
aldeed:collection2,
aldeed:自动窗体,
CFS:标准软件包,
yogiben:自动窗体文件,
CFS:文件系统
{{#with FS.GetFile "images" pictures}}
<img src="{{this.url}}" alt="" class="card-img-bottom">
{{/with}}
Images = new FS.Collection("images",{
stores: [new FS.Store.FileSystem("images")],
filter:{
allow:{
contentTypes: ['image/*']
}
}
});
Images.allow({
insert: function(userId,fileObj){
return true;
},
update:function(userId,fileObj){
return true;
},
download: function(userId,fileObj){
return true;
}
});
Posts = new Mongo.Collection('posts');
Posts.allow({
insert:function(userId,fileObj){
return true;
},
update:function(userId,fileObj){
return true;
}
});
PostSchema = new SimpleSchema({
title:{
type: String,
autoform:{
label:false,
type:"textarea",
placeholder:"Comparte con la comunidad"
}
},
pictures:{
type:[String],
optional: true,
label: " "
},
'pictures.$':{
autoform:{
type:"fileUpload",
collection: 'images',
selectFileBtnTemplate: 'mySelectFileBtn',
previewTemplate: 'myFilePreview',
uploadProgressTemplate: 'myUploadProgressTemplate'
}
},
author:{
type:String,
label: "Author",
autoValue: function(){
return this.userId
},
autoform:{
type:"hidden"
}
},
createdAt:{
type: Date,
label: "created At",
autoValue:function(){
return new Date()
},
autoform:{
type:"hidden"
}
}
});
Posts.attachSchema(PostSchema);
我有这个错误
排队任务中的异常:错误:选择器无效:tzYd8ocD9xhvCCfk7
如果图片显示不是数组
非常感谢你的帮助。
答案 0 :(得分:0)
您提供的信息并未显示您如何发布图片,所以也许您可能也想展示这些图片?