title: Multer file filtering based on MIME type
body: <p>I have the code below. I would like use multer to accept only documents with the MIME type for docx. Otherwise, I would like to produce an error. I plan on doing vetting on the front-end as well, but for security purposes would like to implement here as well. The following code is returning an error, can anybody tell me where i am wrong?</p>
  
  <pre><code>const multer = require('multer')
  const fs = require('fs')
  
  const upload = multer({
    dest: './upload',
    fileFilter: function (req, file, cb) {
        if (req.file.mimetype != 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
            return cb(new Error('Wrong file type'))
        }
        cb(null,true)
    }
  }).single('file');
  
  app.post('/upload', upload, function(req, res) {
  
    console.log(req.file);
  };
  </code></pre>