title: How to parse formdata on node serverside?
body: <p>I'm using nodejs, REACT, express, axios. I want to make upload function, but I can't. When I upload file, server cannot parse the uploaded file (only shows {} log).</p>
  
  <p>Below is my frontend code</p>
  
  <p>When user click UPLOAD button on form element, 'handleSubmit' function is called, and 'handleSubmit' calls 'fileUploadRequest' function.</p>
  
  <p>In 'fileUploadRequest' function, everything is good. I can see infomations of attached file.</p>
  
  <pre><code>&lt;form onSubmit={this.handleSubmit} encType='multipart/form-data'&gt;
                      &lt;input type="file" onChange={this.handleChange}/&gt;
                      &lt;input type="submit" value="UPLOAD"/&gt;
  &lt;/form&gt;
  
  export function fileUploadRequest(username, uploadFile, uploadFileName) {
      return (dispatch) =&gt; {
          dispatch(fileUpload());
  
          let formData = new FormData();
          formData.append('fileName', uploadFileName);
          formData.append('fileHandler', uploadFile);
  
          return axios.post('/upload/upload', {formData})
          .then((response) =&gt; {
              dispatch(fileUploadSuccess());
          }).catch((error) =&gt; {
              dispatch(fileUploadFailure());
          });
      };
  }
  </code></pre>
  
  <p>below is backend code.</p>
  
  <pre><code>router.post('/upload', (req, res) =&gt; {
  
      console.log(req.body.);
  
      var form = new formidable.IncomingForm();
      form.parse(req, (err, fields, files) =&gt; {
          console.log('parse');
          console.log(fields);
          console.log(files);
      });
  });
  </code></pre>
  
  <p>on req.body log, I can see only '{ formData: {} }' log.</p>
  
  <p>'fields' and 'files' are all '{}' on log</p>
  
  <p>How can I parse attached file on server?</p>