Results 1 to 3 of 3

Thread: Newbie:Problem with file upload

  1. #1
    Join Date
    Jan 2005
    Posts
    2

    Default Newbie:Problem with file upload

    I am trying to upload a file.

    First I created a form with several fields and a command and everything worked fine. Then I added file field, changed the encryption type to multipart/form-data, added multipartResolver to the definitions. My problem is that request does not seem to pickup any input values now.
    I added the following code to my contoller:

    Code:
    	MultipartHttpServletRequest mRequest =
    			(MultipartHttpServletRequest) request;
    
    		Enumeration enum = mRequest.getAttributeNames();
    
    		while (enum.hasMoreElements()) {
    			String element = (String) enum.nextElement();
    			log.debug(element + ":" + mRequest.getAttribute(element));
    		}
    and I got the following in the log:
    Code:
     org.springframework.web.servlet.DispatcherServlet.THEME:org.springframework.web.servlet.theme.FixedThemeResolver@45215
    org.springframework.web.servlet.DispatcherServlet.CONTEXT:org.springframework.web.context.support.XmlWebApplicationContext: display name ...
    org.springframework.web.servlet.DispatcherServlet.MULTIPART:org.springframework.web.multipart.commons.CommonsMultipartResolver
    org.springframework.web.servlet.DispatcherServlet.LOCALE:org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver@d66ecc
    It looks like my input values are not picked by the request.

    What am i doing wrong?

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    Could you expand more on this? app-servlet.xml, form.html...
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3
    Join Date
    Jan 2005
    Posts
    2

    Default I figured it out

    The problem was with binding.

    I used StringMultiPartFileEditor and it did not work. I replaced it with ByteArrayMultipartFileEditor and now everything is fine.

Similar Threads

  1. Cannot upload file using web flow
    By mcsenter in forum Web Flow
    Replies: 5
    Last Post: Mar 7th, 2011, 09:10 PM
  2. Saving large files to a db using hibernate?
    By Dan Washusen in forum Data
    Replies: 10
    Last Post: Sep 20th, 2006, 12:18 PM
  3. Deferred file upload
    By Thomas Matzner in forum Web
    Replies: 4
    Last Post: Sep 30th, 2005, 12:06 PM
  4. Replies: 1
    Last Post: Jun 16th, 2005, 04:53 AM
  5. Replies: 1
    Last Post: Jun 16th, 2005, 04:30 AM

Posting Permissions

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