Jun 7th, 2012, 10:42 AM
problems with multipart/form-data boundary and controller
I have this form:
<form id="uploadForm" name="uploadForm" method="POST" action="/webapp/spring/upload" enctype="multipart/form-data; boundary=--------boundary123">
My controller's method is bound like this:
@RequestMapping(value = "/upload", method = RequestMethod.POST, headers = "content-type=multipart/form-data")
I'm getting this error: Unsupported Media Type
This is happening because my request type is for some reason changed to "application/x-www-form-encoded". Is my form enctype not specified correctly?
When I change enctype to "multipart/form-data" only (no boundary) the method is called but then I get an error about a missing multipart boundary.
Has anyone encountered that problem before? How to fix it? Ultimately I'm trying to upload a file (with apache ServletFileUpload).
Jun 7th, 2012, 11:49 AM
Try without the 'boundary=' part... That might confuse the browser (also not sure what it should do).
And please next time use [ code][/code ] tags when posting code(snippets) ....