Spring MVC – AngularJS – File Upload – org.apache.commons.fileupload.FileUploadException

I faced the same issue and encountered the same issue even after updating the transformRequest. ‘Some how, the header boundary doesn’t seem to have set correctly.

Following http://uncorkedstudios.com/blog/multipartformdata-file-upload-with-angularjs, the problem is resolved. Extract from the location….

By setting ‘Content-Type’: undefined, the browser sets the Content-Type to multipart/form-data for us and fills in the correct boundary. Manually setting ‘Content-Type’: multipart/form-data will fail to fill in the boundary parameter of the request.

Not sure if this helps any one but perhaps makes it easy for people looking at this post… At least, it makes it less difficult.

Leave a Comment