File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes multipart/form-data cancel issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "multipart/form-data cancel issue" Watch "multipart/form-data cancel issue" New topic

multipart/form-data cancel issue

Milan Tomc

Joined: Mar 06, 2006
Posts: 17
Hi all,

I'm uploading files to a database.

When the user chooses the file and presses "upload-button" (submit) the data starts streaming. Then I wanted to see what would happen if I click something else whilst busy (like another link, button or browsers stop button) and that has cost me a day and a half now.

What i get is:

00:17:43,578 ERROR [CommonsMultipartRequestHandler] Failed to parse multipart request
org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
at org.apache.commons.fileupload.FileUploadBase.parseRequest(
at org.apache.commons.fileupload.FileUploadBase.parseRequest(
at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(
at org.apache.struts.util.RequestUtils.populate(
at org.apache.struts.action.RequestProcessor.processPopulate(
at org.apache.struts.action.RequestProcessor.process(
at org.apache.struts.action.ActionServlet.process(
at org.apache.struts.action.ActionServlet.doPost(
at javax.servlet.http.HttpServlet.service(

User sees no problems. The application does what user "clicks".

What really bothers me is the fact that, once user clicks on "upload", every byte must be transmited. If I click on browsers stop button, I get the above exception. After that I click on something else and see on the status bar that the browser is sending the rest of the bytes (I tested with 50 Mb). When this is done the application does what it is told to.

So, did somebody think of a way to let the user change his mind, cancel the upload, and without waiting for tens of (canceled) Megabytes to be transmited, continue as he pleases?
Milan Tomc

Joined: Mar 06, 2006
Posts: 17
Or with other words:

Is there a way to catch this exception and let the browser know we are no more interested in de request/stream?
I agree. Here's the link:
subject: multipart/form-data cancel issue
It's not a secret anymore!