title: A super simple Multer question, nested file uploading
body: <p>I'm trying to do an image upload with Multer and Express. Doing just an image upload is going fine and everything works, the problem is, I want to send more than just one photo. Let me explain. I got the most basic form ever, not worth sharing. Then when submitting the form with <strong><em>JUST</em></strong> an image, the axios request looks like this: </p>
  
  <pre><code>async onSubmit() {
      const formData = new FormData();
      formData.append('file', this.person.personData.file)
      this.obj.file = formData
  
      try {
          await axios.post('/projects/new', this.obj.file);
          this.message = 'Uploaded';
      } catch (err) {
          console.log(err);
          this.message = 'Something went wrong'
      }
  },
  
  </code></pre>
  
  <p>The post route in Express to receive the image looks like this: </p>
  
  <pre><code>personRoutes.post('/new', upload.single('file'), (req, res) =&gt; {
      console.log('BODY: ', req.body)
      console.log('REQ.FILE: ', req.file)
  
      const person = new Person({
          personData: {
              file: req.file.path
          }
      });
      person.save()
          .then(result =&gt; {
              console.log('YES', result)
              res.redirect('/projects')
          })
          .catch(err =&gt; {
              console.log('KUT', err)
          })
  });
  
  </code></pre>
  
  <p>req.file is the <code>upload.single('file')</code> file. Req.body will hold the text fields, if there were any. Ez Pz, so far so good. Now, where things get a bit sketchy is, what if I wanted to upload more than just one photo? So my <code>obj</code> object would not only hold a <code>file</code> property but a few others aswell. Currently I am directly sending the formData file with </p>
  
  <pre><code>await axios.post('/projects/new', this.obj.file);
  </code></pre>
  
  <p>But if my <code>obj</code> contained more than just a file, I would have to to this: </p>
  
  <pre><code>await axios.post('/projects/new', this.obj);
  </code></pre>
  
  <p>But what in the world should my Express post route look like? Because <code>req.file</code> will now (as far as I know) forever be <code>undefined</code> because <code>file</code> is not defined inside <code>req</code> object. It is defined in <code>req.body</code> object. Accessing the file as <code>req.obj.file</code> won't do anything. Any help would be very much appreciated. I don't even know if it is possible. And if not, what other options do I have? </p>
  
  <p>Thanks in advance!</p>