FileUpload and Chrome

501 views
Skip to first unread message

Michel

unread,
Nov 30, 2008, 2:58:39 AM11/30/08
to Google Web Toolkit
Hi,

I have a panel with a FileUpload widget. It works fine in hosted mode,
Internet Explorer and Mozilla, but not in Chrome. In Chrome, it looks
slightly different, and the upload fails at the server end. In the
others, the upload works just fine.


In the other browsers (ie not Chrome), the panel shows a box, in which
the filename appears after I have selected it from the filesystem.
Next to that there is a button, labelled 'BROWSE'. Under that is the
submit button.

In Chrome, there is a label, which says 'Choose File' and next to
that, it says 'No file chosen'. So there isn't the usual box.
Underneath that is again the submit button. I can choose a file in
Chrome in the usual way (by pressing Choose File), but then if I
submit it, the upload fails on the server end, with the following
error:


org.apache.commons.fileupload.FileUploadException: Processing of
multipart/form-
data request failed. Connection reset
at org.apache.commons.fileupload.FileUploadBase.parseRequest
(FileUploadB
ase.java:384)
at
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(
ServletFileUpload.java:116)
at ac.otago.flags.server.FileUploadServlet.doPost
(FileUploadServlet.java
:74)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:206)


My DoPost method in the upload servlet looks like this (as far as it
gets)

protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{

try {
ServletRequestContext ctx = new ServletRequestContext(request);

if (ServletFileUpload.isMultipartContent(ctx) == false) {
sendResponse(response, new FormResponse(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"The servlet can only handle multipart requests."
+ " This is probably a software bug."));
return;
}

// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(
new DiskFileItemFactory());

// Parse the request
List<FileItem> items = upload.parseRequest(request);


And this final line throws the exception. (It's line 74)


I have posted this question on apache commons forum, but go no
response.


Why would this happen in Chrome, or how can I proceed to solve this
problem?


Thank you for your help,


Michel

Sumit Chandel

unread,
Dec 1, 2008, 7:50:27 PM12/1/08
to Google-We...@googlegroups.com
Hi Michel,

It seems like this is a problem specific to Google Chrome (see Issue #1269 or search for others like it on the Chromium Issue Tracker). One way to make sure is to test out your FileUpload widget in Safari to make sure this isn't a more fundamental problem (unlikely).

Issue #1269:
I would recommend starring the issue to keep an eye out for updates and fixes.

Hope that helps,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages