title: Multiple file upload on express js with multer returns empty array
body: <p>I am building an app on Glitch with express js which requires the user to upload multiple files. Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>  var express = require('express');
  var cors= require('cors');
  var bodyParser= require('body-parser');
  var contexts= require('./contexts');
  var path= require('path');
  var fileUpload= require('express-fileupload');
  var multer= require('multer');
  var upload = multer();
  
  var app = express();
  
  app.use(cors());
  app.use(bodyParser.json());
  app.use(fileUpload());
  
  app.set('view engine', 'ejs');
  app.set('views', 'views');
  app.use(express.static('views/'));
  //here express-fileuploads works fine
  app.post('/getcontexts', function (req,res) {
     var context=contexts.get(req.files.file.data.toString());
     res.render('rast', {length: context.length, content : context});    
       });
  
  //this is when I get an empty array 
     app.post('/getrast', upload.array('rastfiles'), function (req, res) {
    
       res.json({data: req.files});
       });
  
     var listener = app.listen(process.env.PORT, function () {
      console.log('SERVER STARTED ON PORT ' + listener.address().port);
     });</code></pre>
  </div>
  </div>
  </p>
  
  <p>and here is the ejs form I use:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>        &lt;form action="/getrast" method="POST" enctype="multipart/form-data"&gt;
          &lt;label for="rastfiles"&gt;Please select your Rast genome files with .txt extension&lt;/label&gt;
          &lt;br&gt;
          &lt;input type="file" id="file" name="rastfiles" class="inputFile" multiple&gt;
          &lt;br&gt;
          &lt;input type="submit" value="Run" id="sub"&gt;
        &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I already used express-fileupload to upload a single file and it worked just fine. However, when I use multer to upload multiple files I get and empty array when logging req,files into the console. Any idea why this might be happening?</p>
  
  <p>I'd really appreciate any help. Thanks!</p>