Reputation: 3869
I'm trying collectionFS (v 0.4.3) for the first time with the default pattern but with no luck:
I created a file in /models: collection_fs.js
var Images = new FS.Collection("images", {
stores: [new FS.Store.FileSystem("images", {path: "~/uploads"})]
});
Then I added a template to my form events: upload_form.coffee
Template.uploadForm.events "change .myFileInput": (event, template) ->
FS.Utility.eachFile event, (file) ->
Images.insert file, (err, fileObj) ->
But it keeps telling me:
Uncaught ReferenceError: Images is not defined
I know that collection_fs.js runs (checked with console.log). If I'm not wrong, a variable with var in front has the global scope. So I don't understand what's wrong.
Thank you!
Upvotes: 2
Views: 753
Reputation: 2474
Your collection is defined local. If you remove the keyword var from your collection than you can use the collection globally.
Images = new FS.Collection("images", {
stores: [new FS.Store.FileSystem("images", {path: "~/uploads"})]
});
Upvotes: 8