Meteor-files: how to upload multiple image or files??

Created on 4 Oct 2016  路  5Comments  路  Source: veliovgroup/Meteor-Files

question

Most helpful comment

Template.uploadForm.events({
  'change #fileInput': function (e, template) {
    if (e.currentTarget.files) {
      _.each(e.currentTarget.files, function (file) {
        Images.insert({
          file: file
        });
      });
    }
  }
});

All 5 comments

var file = e.target.files[0];
var Uid = Meteor.userId();

for(var i=0; i<file.length ; i++){

    Images.insert({
      file: file,
      streams: 'dynamic',
      chunkSize: 'dynamic',
      meta: {Uid: Uid}
    }, true);

  };

Sir ..This is my code..
i am so confused. please ..can you tell me how to multiple image insert in Image.insert statement.

Template.uploadForm.events({
  'change #fileInput': function (e, template) {
    if (e.currentTarget.files) {
      _.each(e.currentTarget.files, function (file) {
        Images.insert({
          file: file
        });
      });
    }
  }
});

Thank you so much @dr-dimitru

@sunil111 glad it helped, do not hesitate to ask more.

Please, support this project by:

Was this page helpful?
0 / 5 - 0 ratings