Announcement Announcement Module
No announcement yet.
MultipartFile is null when uploading a file Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MultipartFile is null when uploading a file

    Hello everyone, I've been following this tutorial, but I can't get it working...

    I have this jspx:

    <form:deploy multipart="true" id="fc_..." modelAttribute="jrpmapplication" path="/jrpmapplications/fileupload" z="user-managed">
    		<field:input id="c_..." field="name" z="user-managed"/>
            <field:input id="c_..." field="ip" z="user-managed"/>
            <field:input id="c_..." field="port" z="user-managed"/>
            <field:input id="c_..." field="content" required="true" type="file" z="user-managed"/>
    And this controller:

    @RequestMapping(value = "/fileupload", produces = "text/html")
    	public String fileUpload(@RequestParam(value = "ip", required = false) String ip, @RequestParam(value = "port", required = false) BigDecimal port, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "content", required = false) MultipartFile content, Model uiModel) {
    Basically I only removed BindingResult bindingResult from the controller signature, cause if I put it it'd complain that it has to go right after the model (unlike that example in which it's before it, but even if i put it after it it complains anyways).

    While the first tree parameters are ok, content is null...

    What am I missing?

    Thanks a lot everyone!!

    EDIT: this is the request payload:

    Content-Disposition: form-data; name="name"
    Content-Disposition: form-data; name="ip"
    Content-Disposition: form-data; name="port"
    Content-Disposition: form-data; name="content"; filename="fifthstep.xlsx"
    Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    Last edited by tylerdurden83; Jul 3rd, 2013, 09:38 AM.

  • #2
    You can try the following one instead at

    It works for sure!.


    • #3
      Originally posted by delgad9 View Post
      You can try the following one instead at

      It works for sure!.
      First of all thank you for the help!
      I had already managed to solve the issue sadly, and I admit that I forgot to post here my solution (which I'd have got to if I used your tutorial from the start).

      In my case, commenting:

      <bean id="multipartFilter" class=" ultipartFilter">
      <property name="multipartResolverBeanName" value="multipartResolver" />
      from the application-context.xml solved the null issue. I'm not sure what that does, but I see it's not present in the tutorial that you linked, so it's probably safe to have it removed as I did!