title: Why formData does not work with multiple files?
body: <p>I'm facing a problem with a React project I'm working on: I'm trying to upload multiple images to a Node Express API. I'm using a formData object and I used the <code>append()</code> method to append the form fields from the component State.</p>
  
  <p>In the Express code I'm using multer, all the attributes in the <code>req.body</code> are there but <code>req.files</code> is empty.</p>
  
  <p>I changed the code to upload a single image also using formData() and it works; the problem seems to be only when I try with multiple files using the formData object. I also tested using a regular form (not react) and that also worked!</p>
  
  <p>I'm wondering if there is something I'm missing when I use formData with a file input with multiple files?</p>
  
  <pre><code>import React, { Component } from "react";
  import axios from "axios";
  
  class Form extends Component {
    constructor() {
      super();
      this.state = { images: {} };
    }
  
    onChangeImages = e =&gt; {
      this.setState({ images: e.target.files })
    };
  
    onSubmit = e =&gt; {
      e.preventDefault();
  
      const { images } = this.state;
  
      const formData = new FormData();
  
      formData.append("images", images);
  
      axios
        .post("/api/post/create", formData)
        .then(res =&gt; console.log(res.data))
        .catch(err =&gt; console.error(err));
    };
  
    render() {
      return (
        &lt;form onSubmit={this.onSubmit}&gt;
  
          &lt;input
            onChange={this.onChangeImages}
            type="file"
            name="images"
            multiple
            accept="image/png, image/jpeg, image/jpg"
          /&gt;
  
          &lt;br /&gt;
          &lt;input type="submit" value="Send" /&gt;
        &lt;/form&gt;
      );
    }
  }
  
  export default Form;
  </code></pre>
  
  <hr>
  
  <p>Express code </p>
  
  <pre><code>const express = require('express');
  const router = express.Router();
  const multer = require('multer');
  const upload = multer({ dest: 'uploads/' });
  
  
  router.post('/create', upload.array('images', 2), (req, res) =&gt; {
      console.log(req.files);
      console.log(req.body);
      res.status(200).json(req.body);
  });
  
  
  module.exports = router;
  </code></pre>