What would be the canonical way to handle a file upload with Meteor?
I 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); } });
1.4m articles
1.4m replys
5 comments
57.0k users