title: 415 (Unsupported Media type) when trying to post formData to Spring
body: <p>I want to post pdf files to spring, using formData. </p>
  
  <p><strong>Javascript Code:</strong></p>
  
  <pre><code>var formData=new FormData();
  formData.append("file",file);
  
    $http({
      method: 'POST',
      accept: 'multipart/form-data',
      url: '/upload',
      contentType: 'multipart/form-data',
      data: formData
    }).then(function successCallback(response) {
      console.log(response);
    }, function errorCallback(response) {
      console.log(response);
    });
  </code></pre>
  
  <p><strong>Spring Code:</strong></p>
  
  <pre><code>@Controller
  public class upload {
  
  
  @RequestMapping(value = "/upload", method = RequestMethod.POST,consumes="multipart/form-data", headers = "content-type=multipart/form-data")
  private void upload(MultipartHttpServletRequest request, HttpServletResponse response){
  
  }
  }
  </code></pre>
  
  <p>I get the Error <strong>"415 (Unsupported Media Type)"</strong> when using this code. I tried to post json objects (application/json instead of multipart/form-data) and it worked perfectly. </p>
  
  <p>Is multipart/form-data the wrong type to use in my case? Or is there just an error in the code?</p>
  
  <p>I would be very thankful for potential help.</p>