title: Upload multiple files with Multer ? (Nodejs)
body: <p>I just can't figured whats wrong why my codes below. I try to upload multiple files that given by a simple uploader (JADE):</p>
  
  <pre><code> input#upload-gallery(type='file', multiple="multiple", name='picture')
  </code></pre>
  
  <p>and some javascript controller, to send data each time a user insert files to uploader</p>
  
  <pre><code>   $("#upload-gallery").on('change', function(){
          var files = $(this).get(0).files;
          if (files.length &gt; 0) {
              var formData = new FormData();
  
              for (var i = 0; i &lt; files.length; i++) {
                  var file = files[i];
                  formData.append('pictures', file, file.name);
              }
  
              $.ajax({
                  url          : '/upload/pictures',
                  type         : 'POST',
                  data         : formData,
                  processData  : false,
                  contentType  : false,
                  success      : function (links) {
  
                  }
              });
          }
      })
  </code></pre>
  
  <p>Here's the server part:</p>
  
  <pre><code>var multer          = require('multer');
  var upload          = multer({dest: "./gallery"});
  ...
  ...
  app.post('/upload/pictures', upload.any(), function(req, res, next){
        console.log(req.files)  // &lt;-- it always return [] array
  });
  </code></pre>
  
  <p>The problem is that <code>req.files</code> always return an empty array. I can make it to upload single file just fine, but I can't make it upload multiple files. So what's wrong here?</p>
  
  <p>What I have tried so far:</p>
  
  <ul>
  <li>change <code>formData</code> part to <code>formData.append('pictures[]', file, file.name);</code> not working</li>
  <li>Change <code>upload.any()</code> to <code>upload.array('pcitures')</code>, doesn't work</li>
  </ul>