> Well, you're not going to get the file data out of request parameters. > Take a look at this doc on commons-fileupload: > > http://commons.apache.org/fileupload/streaming.html
Hi Dave, I modified the servlet to follow the same code snippet on the commons fileupload page. The only difference here is that I'm using spring-webmvc, which shouldn't matter (I don't think). My servlet method (code below) still gets called with HTTP POST from the client. It never prints anything -- meaning the FileIterator is empty -- I verified this in the debugger. In fact, this is what the HTTP POST looks like the following. You can see there is no content under the header...and I can't seem to resolve why? POST /post-document.do HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Language: en-us Referer: http://localhost:8080/admin/ Content-Type: multipart/form-data; boundary=---------------------------7d91ee26430a42 UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; InfoPath.1) Host: localhost:8080 Content-Length: 49 Connection: Keep-Alive Cache-Control: no-cache Cookie: JSESSIONID=1t4e9ind93wxl The servlet looks like this: public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws Exception { try { LOGGER.info("Within PostDocumentController()--> handleRequest"); // check that we have a file upload request if(!ServletFileUpload.isMultipartContent(req)) { return new ModelAndView("document-post-failed"); } // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(); // Parse the request FileItemIterator iter = upload.getItemIterator(req); while (iter.hasNext()) { FileItemStream item = iter.next(); String name = item.getFieldName(); InputStream stream = item.openStream(); if (item.isFormField()) { System.out.println("Form field " + name + " with value " + Streams.asString(stream) + " detected."); } else { System.out.println("File field " + name + " with file name " + item.getName() + " detected."); // Process the input stream } } return new ModelAndView("document-post-success"); } catch(Exception e) { LOGGER.error(Utility.getStackTrace(e)); return new ModelAndView("document-post-failed"); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
