I am using following meteor package to upload the image
https://github.com/CollectionFS/Meteor-CollectionFS
Code I am using
Uploads =new FS.Collection('uploads',{
stores: [new FS.Store.FileSystem('uploads',{path:'~/projectUploads'})]
});
if (Meteor.isClient) {
Template.makedobox3.events({
'change .fileinput':function(event,template){
FS.Utility.eachFile(event,function(file){
var fileObj=new FS.File(file);
Uploads.insert(fileObj,function(err){
console.log(err);
});
})
}
});
}
I am getting error when I try to upload a file in console
M…r.m…e.errorClass {error: 404, reason: "Method not found", details: undefined, message: "Method not found [404]"
I am on window environment. Auto-publish and insecure packages are installed. I am not sure what I am missing?
Make sure you also define this collection on the server side:
The reason it can't find the method is the collection isn't defined on the server side (in the
/server
folder) or in a block of code that runs inif(Meteor.isServer) {
instead ofif(Meteor.isClient)
.One alternative is Meteor is isomorphic, so you can just move the collection definition from the
Meteor.isClient
block so it runs on both the client and server.