Results 1 to 3 of 3

Thread: MultipartHttpServletRequest File upload problem

  1. #1
    Join Date
    Jul 2009
    Posts
    7

    Question 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. #2
    Join Date
    Feb 2006
    Location
    Nancy, France
    Posts
    145

    Default

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

    Code:
    <form enctype="multipart/form-data">
    ...
    </form>
    Université Nancy 2
    France

  3. #3
    Join Date
    Jul 2009
    Posts
    7

    Default

    Quote 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">

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •