Hi,
I create a form to upload image using autoform. i’ve succeed to insert it to my collection, but the image cannot be upload…
here is my code
Recipes = new Meteor.Collection('recipes');
Images = new FS.Collection("images", {
stores: [new FS.Store.GridFS("filesStore", {path: "~/img/uploads"})]
});
Recipes.allow({
insert : function (userId, doc) {
return !!userId;
},
update: function (userId, doc) {
return !!userId;
}
});
Images.allow({
insert: function(userId, doc) {
return !!userId;
},
update: function (userId, doc) {
return !!userId;
}
});
RecipeSchema = new SimpleSchema({
name : {
type:String,
label:'Menu'
},
pict : {
type:String,
label : 'Picture',
autoform : {
afFieldInput: {
type: "cfs-file",
collection: "images",
onBeforeInsert : function () {
}
}
}
},
author : {
type : String,
label : 'Author',
autoValue : function () {
return this.userId
},
autoform : {
type:'hidden'
}
}
});
Recipes.attachSchema(RecipeSchema);
i also got warning when i insert the data : The provided value ‘undefined’ is not a valid enum value of type XMLHttpRequestResponseType.