When I call filepicker.pickAndStore() for the first time in a template everything works fine. Also closing the modal and clicking the button again works fine (modal is displayed again). When I click on a link inside my meteor app to get to another page (of course via html5 pushstate like on every meteor page, no standard a links with a real page refresh) and then go back to the page with the filepicker stuff in it, the button does not do anything anymore. The filepicker modal or anything is NOT displayed. And i also tried call back function as given in the documentation. I'am describing my code below
Template.content.events({
'click #top_add_file': function (evt) {
evt.preventDefault();
console.log("upload file button is clicked")
Session.set("widgetSet", false);
if (!Session.get("widgetSet")) {
var cb = function () {
filepicker.pickAndStore(
{
mimetypes: ['application/pdf', 'application/msword', 'application/mspowerpoint', 'text/plain'],
container: 'window',
services: ['COMPUTER'],
folders: true
},
{
location: 'S3'
},
function (InkBlob) {
console.log("InkBlob="+InkBlob)
InkBlob.forEach(function (ib) {
Meteor.call("createContent", ib, Meteor.content_file, function (error, result) {
if (error) {
FlashMessages.sendError("Error in saving file")
} else {
FlashMessages.sendSuccess("Successfully Saved File")
}
})
})
},
function (FPError) {
FlashMessages.sendError("Error in uploading file. Please try again")
}
)
};
loadPicker(Meteor.fpkey, cb);
}
},
The answers to this StackOverflow question may help: Integrating Filepicker.IO with Meteor
One of them highlights an atmosphere package for filepicker: https://github.com/guido4000/loadpicker
Also, this example shows integrating a 3rd-party modal component into meteor: https://github.com/alanning/meteor-modal-example