To make it easy, I published the Atmosphere package ( github loadpicker ), which can be installed using Meteorite.
The file picker script is loaded dynamically upon invocation and the key is set on the callback of a successful file attempt. The loading of the script from the template created or created by the template is saved.
Install:
mrt add loadpicker
Call the script with your private key filepicker.io and a callback function to create a drag region:
loadPicker(key, cb);
An integration example is as follows:
if (Meteor.isClient) { Session.set("widgetSet", false); var key = "xxxxxxxxxxxxxxxxx"; var cb = function () { filepicker.makeDropPane($('#exampleDropPane')[0], { dragEnter: function() { $("#exampleDropPane").html("Drop to upload").css({ 'backgroundColor': "#E0E0E0", 'border': "1px solid #000" }); } }); }; Template.home.created = function ( ) { if (!Session.get("widgetSet")) { loadPicker(key, cb); } }; }
HTML
<h1>Drop Pane</h1> <div id="exampleDropPane">Drop Here!</div> <div><pre id="localDropResult"></pre></div>
CSS
#exampleDropPane { text-align: center; padding: 20px; background-color: #F6F6F6; border: 1px dashed #666; border-radius: 6px; margin-bottom: 20px; }
guido source share