Announcement Announcement Module
Collapse
No announcement yet.
problems with multipart/form-data boundary and controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problems with multipart/form-data boundary and controller

    Hello,

    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).
    Thanks,

    M

  • #2
    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) ....

    Comment

    Working...
    X