How to upload files with Filestack in Meteor?

I have added this code in my blaze form template provide by the Filestack:

            <script type="text/javascript" src=""></script>
                var client = filestack.init('MY API KEY');
                function showPicker() {
                    }).then(function(result) {
            <input type="button" value="Upload" onclick="showPicker()" />

I am getting this errors:

project.js:27 Uncaught ReferenceError: filestack is not defined

When i click the button i get this error message:

VM13567:4 Uncaught TypeError: Cannot read property 'pick' of undefined

I have also tried this code:

Template.layout.onRendered(function () {
    $('head').append('<script type="text/javascript" src=""></script>');

Anyone worked befor with Filestack with Meteor. Is there any Package or instruction/docs?

I just signed up for a test account and was able to upload a file as follows. I am sure there are other solutions. I believe your approach didn’t work because you tried to filestack.init before the script from filestackapi was loaded. The Meteor way is to use Meteor.startup, but you might also have success with the script defer option.

    .done(function(script, textStatus){
      WebApp.filestack = filestack.init(<API KEY>);
    .fail(function(jqxhr, settings, exception){
  'click button.filestack'(event,instance){
      }).then(function(result) {
<template name="filestack">
  <div class="well">
  <button class="filestack">Upload</button>
1 Like

Great! It worked. Thanks!
How can i upload those files to my collection, find and display for the specific post?

You just need to store the elements in result.filesUploaded in a collection of your choosing, just as any other document you would store in mongo.

1 Like

Do i just need to store the api result into my collection with post/user id? Can you please share some code?