Announcement Announcement Module
Collapse
No announcement yet.
MultipartHttpServletRequest File upload problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MultipartHttpServletRequest File upload problem

    Hi,
    I'm trying to upload a file, but I keep getting a null MultipartFile back.
    The controller code:
    Code:
    MultipartHttpServletRequest multipartRequest  = (MultipartHttpServletRequest)request;
    		MultipartFile multipartFile = multipartRequest.getFile("configFile");
    The input:
    Code:
    <input type='file' name='configFile' />
    The bean:
    Code:
    <bean id="multipartResolver"
    class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <property name="maxUploadSize" value="100000"/>
    </bean>
    I don't need to store the file, I only extract the content, thats all. If you have any questions about the code feel free to ask.
    Thanks!

  • #2
    Did you clearly specify that it's a multipart form ?

    Code:
    <form enctype="multipart/form-data">
    ...
    </form>

    Comment


    • #3
      Originally posted by mlarchet View Post
      Did you clearly specify that it's a multipart form ?

      Code:
      <form enctype="multipart/form-data">
      ...
      </form>
      Yes.
      Code:
      <form method="post" action="view-config.htm" name="configform" enctype="multipart/form-data">

      Comment

      Working...
      X