title: How to use axios to upload image files through http
body: <p>I am using axios to upload image file to server but failed. Below is the code:</p>
  
  <pre><code>let data = new FormData()
  data.append('image', image)
  axios({
  type: type,
  payload: {
    request: {
      url: url,
      method: 'post',
      timeout: 60000,
      headers: {
        'ACCESS_TOKEN': token,
        'Content-Type': 'multipart/form-data',
      },
      data: data
    }
  })
  </code></pre>
  
  <p>I got 400 Bad Request error. Below is the response from server:</p>
  
  <pre><code>{"timestamp":1480851939951,"status":400,"error":"Bad Request","exception":"org.springframework.web.multipart.support.MissingServletRequestPartException","message":"Required request part 'image' is not present.","path":"/upload/image"}
  </code></pre>
  
  <p>I have used postman to test the server api and it works fine. What wrong with my code?</p>
  
  <p><strong>EDIT1</strong>
  The image object was got from . Below is the code to get the image object</p>
  
  <pre><code>    var fr = new FileReader();
      fr.onload = function () {
        let image = fr.result()  //image is got here
  
      }
      fr.readAsDataURL(file);
  </code></pre>