title: sending a file with axios, without FormData api
body: <p>I can send a file to the server using axios and the FormData api, like that : </p>
  
  <pre><code>    persist(avatar){
          let data = new FormData();
          data.append('avatar', avatar);
          axios.post(`/api/users/${this.user.name}/avatar`, data)
              .then(() =&gt; flash('Avatar uploaded!'));
      }
  </code></pre>
  
  <p>The avatar param, passed to persist(), is a file object from a form input of type "file".</p>
  
  <p>I can then grab the file on the server side.</p>
  
  <p>Is it possible to do it without using FormData ?  That is, to simulate the FormData work ?   Basically, I'm trying to understand the extra work done by the FormData api. Maybe it's not possible using axios, and I should do that with plain XMLHttpRequest.</p>
  
  <p>Of course, simply sending the file object won't work : </p>
  
  <pre><code>axios.post(`/api/users/${this.user.name}/avatar`, {avatar: avatar})
  </code></pre>
  
  <p>On the server side, the avatar object will be empty. I can send metadata like avatar.name, but not the whole object.</p>