title: Multer doesnt populate req.file no matter what I do
body: <p>I have literally tried every possible solution to the problem but none of them works, the interesting thing is that I can indeed access req.body but cannot access req.file. If somebody has any idea please share it, thanks.</p>
  <p>the form:</p>
  <pre><code>&lt;form action=&quot;/books&quot; method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&gt;
      &lt;label for=&quot;cover&quot;&gt;Cover&lt;/label&gt;
      &lt;input type=&quot;file&quot; id=&quot;cover&quot; name=&quot;cover&quot;&gt;
      &lt;button type=&quot;submit&quot;&gt;Create&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>routehandler:</p>
  <pre><code>const imageMimeTypes = ['image/jpeg','image/jpg','image/png', 'image/gif']
  const upload = multer({
      dest: uploadPath,
      fileFilter(req, file, callback){
          if(imageMimeTypes.includes(file.mimetype)){
              return callback(null, true)
          }
          callback(new Error('the mimetype of the image is not valid'), null)
      }
  })
  router.post('/', upload.single('cover'), async (req, res) =&gt; {
      const book = new Book({
          title: req.body.title,
          author: req.body.author,
          publishDate: new Date(req.body.publishDate),
          pageCount: req.body.pageCount,
          description: req.body.description,
          coverImageName: req.file.filename
      })
      try {
        await book.save();
        res.redirect('/books')
      } catch (error) {
        renderNewPage(res, book, true)
    }
  })
  </code></pre>