Question: How to make each upload open a modal?


When a user drops an upload a modal appears and everything works as expected, but if he/she drops multiple files it breaks and I get a black screen. How can I problematically solve this? Do I listen to the save button action before continue? Guidance would be very appreciated.

'dropped .dropzone': function(event, temp) {
  console.log('files dropped');
  var documentId = this._id;
  var subcategory =;
  FS.Utility.eachFile(event, function(file) {
    var theFile = new FS.File(file);
    theFile.metadata = {
        creatorId : Meteor.userId(),
        archived: false,
        createdAt: new Date(),
        listId: documentId,
        order: Uploads.find().count() + 1,
        category:["Add a Category"],
        subcategory: [subcategory],
        description: "Add description"
    Uploads.insert(theFile, function (err, fileObj) {
      Materialize.toast( + " was successfully saved!", 8000);



<div id="modal1" class="modal bottom-sheet">
    <div class="modal-content">
{{#each edituploads}}
        <input type="text" value="{{}}" name="name">
        <input type="text" value="{{metadata.category}}" name="category">
        <input type="text" value="{{metadata.subcategory}}" name="subcategory">
        <input type="text" value="{{metadata.description}}" name="description">
    <div class="modal-footer">
      <a href="#!" name="save" class="modal-action modal-close waves-effect waves-green btn-flat">Save</a>


Solution was simple.
replaced code above with this.


var modal = Uploads.count().fetch() +1;
$('#modal'+ modal).openModal();