title: Multiple File Upload in Sails JS from form and then push it S3 one by one
body: <p>Well I am trying to upload multiple files from form using Sails JS.
  I am not sure how to fetch multiple files when form is posted. Once I receive the files I would iterate over it to upload it to S3 of AWS.</p>
  
  <p>Single upload is working for me but not multiple.
  Here the github link where the project is uploaded.
  <a href="https://github.com/psudeep/sailsFileUpload/" rel="nofollow noreferrer">https://github.com/psudeep/sailsFileUpload/</a></p>
  
  <pre><code>module.exports = {
      upload: function (request, response) {
          request.file('file').upload(function (err, file ) {
          //console.log(file.length);
            if(_.size(file) &gt;= 0) {
              file = _.first(file);
              //console.log(file);
              // let file_type = _.split(file.type, '/', 2);
              // let file_ext = file_type[1];
              // let new_file_name = file_name + "." +file_ext;
              let new_file_name = "Test.jpg";
              let originalFilePath = file.fd;
  
              //S3 upload service working for single upload - this function will be in loop for multiple files
              S3UploadService.upload_file(originalFilePath,new_file_name, function (err, result) {
                if(err) {
                  response.redirect("/upload?success=false");
                } else {
                  return response.status(200).send({success: true,message:"Successfully uploaded", data: result});
  
                }
              });
            }
          });
      }
  }
  </code></pre>
  
  <p>==========================Form is below=============================</p>
  
  <pre><code>&lt;form name="upload" method="post" action="/upload" enctype="multipart/form-data"&gt;
      &lt;input type="file" class="input03" name="file[]"&gt;&lt;br/&gt;
      &lt;input type="file" class="input03" name="file[]"&gt;&lt;br/&gt;
      &lt;input type="file" class="input03" name="file[]"&gt;&lt;br/&gt;&lt;br/&gt;
      &lt;input type="submit" name="submit" value="Upload"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any one who can help to understand how to fetch multiple post after form is posted?
  You can take pull from the repo and then commit there as well.</p>
  
  <p>Thanks in advance !!</p>