title: How to get req.body from multer
body: <p>I need to get the req. body from the server before it uploading the file to multer.</p>
  <pre><code>const storage = multer.diskStorage({
    destination: function (req, file, cb) {
     console.log(req.body) // null
     const folderName = req.body.folderName // null
      cb(null, `/tmp/my-uploads/${folderName}`)
    },
    filename: function (req, file, cb) {
      const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9)
      cb(null, file.fieldname + '-' + uniqueSuffix)
    }
  })
  
  const upload = multer({ storage: storage })
  </code></pre>
  <p>How to get req.body</p>