未找到Meteor CollectionFS提供错误方法的Meteor文件上载

未找到Meteor CollectionFS提供错误方法的Meteor文件上载,meteor,collectionfs,Meteor,Collectionfs,我使用下面的流星软件包上传图片 我正在使用的代码 Uploads =new FS.Collection('uploads',{ stores: [new FS.Store.FileSystem('uploads',{path:'~/projectUploads'})] }); if (Meteor.isClient) { Template.makedobox3.events({ 'change .fileinput':function(event,template)

我使用下面的流星软件包上传图片

我正在使用的代码

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);
        });


      })
   }
  });  
}
在控制台中尝试上载文件时出错

M…r.M…e.errorClass{错误:404,原因:“未找到方法”,详细信息:未定义,消息:“未找到方法[404]”

我在Windows环境中。安装了自动发布和不安全的软件包。
我不确定我缺少了什么?

请确保您也在服务器端定义了此集合:

Uploads =new FS.Collection('uploads',{
    stores: [new FS.Store.FileSystem('uploads',{path:'~/projectUploads'})]
});
它找不到方法的原因是集合没有在服务器端(在
/server
文件夹中)或在
if(Meteor.isServer){
而不是
if(Meteor.isClient)
中运行的代码块中定义


另一种选择是Meteor是同构的,因此您可以从
Meteor.isClient
块中移动集合定义,使其在客户端和服务器上都运行。

非常感谢。我是这里的初学者,它真的很有帮助。非常感谢!=D