Skip to content

Commit

Permalink
Updated example and a README
Browse files Browse the repository at this point in the history
  • Loading branch information
tomitrescak committed Dec 7, 2014
1 parent 35bb088 commit b036392
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Meteor.startup(function () {
return formData.contentType;
},
finished: function(file, folder, formFields) {
console.log('Write to database: ' + folder + '/' + file);
// perform a disk operation
}
})
});
Expand Down Expand Up @@ -111,6 +111,18 @@ On client we have a possibility to use pre-defined templates, existing for boots
</template>
```

We can also hook onto upload callbacks just like following:

```javascript
// file: client/init.js
Meteor.startup(function() {
Uploader.finished = function(index, file) {
Uploads.insert({file: file.name});
}
})
```


If you wish to use custom URL for your uploads this can be configured as following:

```javascript
Expand Down
6 changes: 2 additions & 4 deletions client/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Meteor.startup(function() {


Uploader.finished = function(index, file) {
if (!Session.get("UploadedFiles")) {
Session.set("UploadedFiles", []);
Expand All @@ -12,8 +10,8 @@ Meteor.startup(function() {

// for reactivity you can write to the collection
// e.g. SomeCollection.insert({path: folder + '/' + file});
console.log('Write to database: ' + folder + '/' + file);
console.log('Write to database: ' + file.name);

Uploads.insert({folder: folder, file: file});
Uploads.insert({file: file.name});
}
})

0 comments on commit b036392

Please sign in to comment.