title: Node, Multer & Axios : Sending a media to server
body: <p>I am struggling with a simple media (mp3/mp4) upload to a server using axios.
  I have an angular application that creates a formData and send this formData to node server via :</p>
  <p><code>return this.http.post(this.apiURL + '/uploadFile', formData);</code></p>
  <p>My server method looks like this :</p>
  <pre><code>app.post('/api/uploadFile', upload.single('file'), (req, res) =&gt; {
    
    inputFile = req.file;
    let fd = new FormData();
    fd.append('file',inputFile.buffer, inputFile.originalname);
  
    axios.post(uploadFileURL , fd, { headers: { 'Content-Type': 'multipart/form-data' } })
      .then((response) =&gt; {
          console.log(response);
      })
      .catch((error) =&gt; {
          console.error(error)
      }) 
  }) 
  </code></pre>
  <p>The inputFile contains the original files. The error I get now is that the request is not a multipart request...</p>
  <p>I tried as well to define the formData differently :</p>
  <pre><code>formData = {
          file: {
              value: inputFile.buffer,
              options: {
                  filename: inputFile.originalname,
                  contentType: inputFile.mimetype
              }
          }
      };
  </code></pre>
  <p>Which brought me to a different error : 'Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found'</p>
  <p>Am I doing something wrong ?
  I am wondering if this could be link to the fact that I use const bodyParser = require('body-parser'); for some of my other requests.
  Any help would be appreciated!</p>
  <p>Thanks</p>
  <p>EDIT :
  Here is my need and what I've done so far :</p>
  <ul>
  <li>I have a web application that allow users to upload media files.</li>
  <li>I have to send those files to a server, but I can not use the browser to send the request directly.</li>
  <li>I created a nodejs application to realize the proxy task of getting the files from the browser and sending it to my remote server.</li>
  </ul>