title: Node.js Multer ".array is not a function"
body: <p>I've been looking and trying to figure this out for two days now, and the only real mention of it that I can find is an old issue report on version 1.1.0 which was closed without resolution: <a href="https://github.com/expressjs/multer/issues/338" rel="nofollow noreferrer">https://github.com/expressjs/multer/issues/338</a></p>
  
  <p>I'm using Node.js SDK and Express framework, with Cloudinary as my image host.</p>
  
  <p>This is just a project for a class, but it's important that I know how to get this to work for future projects.</p>
  
  <pre><code>const multer = require('multer');
  //configure where/how files are stored temporarily
  const storage = multer.diskStorage({
      filename: function(req,file,cb) {
          cv(null,Date.now() + file.originalname);
      },
      destination: function (req, file, cb) {
          cb(null, '/uploads')
        }
  });
  //only accept image files for cloudinary
  const imageFilter = (req,file,cb) =&gt; {
      if (!file.originalname.match(/\.jpg|jpeg|png|gif)$/i)) {
          return cb(new Error('Only image files (jpg, jpeg, png, gif) are allowed!'), false);
      }
      else {
          cb(null,true);
      }
  };
  //configure multer's upload parameters
  const upload = multer({storage:storage, filefilter:imageFilter}).array('image',5);
  
  /* POST new post  */
  router.post('/', upload.array('image', 5) ,asyncErrorHandler(postCreate));
  </code></pre>
  
  <p>console error when trying to run Node: <code>TypeError: upload.array is not a function</code></p>
  
  <p>I'm handling the actual logic of using the files in what is supposed to be the "files" array, but it won't even get that far, it just stops at <code>upload.array()</code> when trying to compile the file.</p>
  
  <p>Below are the dependencies from my package.json just in case any other modules are known to interfere:</p>
  
  <pre><code>  "dependencies": {
      "async": "^3.1.0",
      "body-parser": "^1.19.0",
      "cloudinary": "^1.18.1",
      "connect-flash": "^0.1.1",
      "cookie-parser": "~1.4.4",
      "ejs": "^3.0.1",
      "express": "~4.16.1",
      "express-sanitizer": "^1.0.5",
      "express-session": "^1.17.0",
      "http-errors": "~1.6.3",
      "locus": "^2.0.4",
      "method-override": "^3.0.0",
      "mongoose": "^5.8.5",
      "morgan": "~1.9.1",
      "multer": "^1.4.2",
      "passport": "^0.4.1",
      "passport-local": "^1.0.0",
      "passport-local-mongoose": "^6.0.1",
      "serve-favicon": "^2.5.0"
    }
  </code></pre>