What would be the canonical way to handle a file upload with Meteor?
See Question&Answers more detail:osWhat would be the canonical way to handle a file upload with Meteor?
See Question&Answers more detail:osI used http://filepicker.io. They'll upload the file, store it into your S3, and return you a URL where the file is. Then I just plop the url into a DB.
Wget the filepicker script into your client folder.
wget https://api.filepicker.io/v0/filepicker.js
Insert a filepicker input tag
<input type="filepicker" id="attachment">
In the startup, initialize it:
Meteor.startup( function() {
filepicker.setKey("YOUR FILEPICKER API KEY");
filepicker.constructWidget(document.getElementById('attachment'));
});
Attach a event handler
Templates.template.events({
'change #attachment': function(evt){
console.log(evt.files);
}
});