title: The "path" argument must be of type string. Received undefined - File upload with multer
body: <p>I am trying to upload files with multer and I am receiving this error.</p>
  
  <blockquote>
    <p>internal/validators.js:117</p>
    
    <p>throw new ERR_INVALID_ARG_TYPE(name, 'string', value);</p>
    
    <p>^</p>
    
    <p>TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The "path"
    argument must be of type string. Received undefined</p>
  </blockquote>
  
  <p>I am facing this problem when I try from both angular and postman.
  My code:</p>
  
  <pre><code>import multer from 'multer';
  
  export const upload = multer({
  
    storage: multer.diskStorage({
      destination: (req, file, cb) =&gt; cb(null, process.env.HOST_PORTAL_DIR),
      filename: (req, file, cb) =&gt; cb(null, helpers.generateFileId(file.mimetype)),
    }),
  
  }).single('file');
  
  router.post('/', function (req, res) {
    upload(req, res, function (err) {
      if (err instanceof multer.MulterError) {
  
        console.log('Multer error', err);
      } else if (err) {
  
        console.log('unknown error', err);
      }
  
  
    });
  });
  </code></pre>