commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin <>
Subject Re: problems using progresslistener with servletfileupload
Date Tue, 29 Dec 2009 04:22:36 GMT
Hello Martin,

Thanks for your prompt reply! What you are saying certainly explains the problem I am having
in that my expectations were incorrect. I must admit though that I am very surprised by this
behavior. Even after rereading the documentation I am still left with the impression that
progresslistener is intended to give feedback as the file is being uploaded but this is not
explicitly stated anywhere. Now I am wondering why even have a progresslistener? Is this feature
useful for anything besides indicating how much of a file has been processed right at the
very end which doesn't seem that useful to me? Thanks again for your help!


From: Martin Cooper <>
To: Commons Users List <>
Sent: Tue, December 29, 2009 12:10:03 AM
Subject: Re: problems using progresslistener with servletfileupload

This is why earlier versions of Commons FileUpload didn't have a
progress API - it's not possible to make it work as people expect.

For the servlet containers I'm familiar with, the container receives
the request and stores it in its entirety prior to invoking any
servlets or filters or whatever. That means that the actual upload of
the data from the browser to the server has already happened before
Commons FileUpload has any chance to even see the request, let alone
initialise a progress mechanism. So the progress mechanism is tracking
the progress of processing the upload once it's already on the server,
not the progress of the upload itself.

I believe the only way you're going to be able to track the process of
the upload itself is to find a container-specific API that lets you
see the request as it comes in. I don't know that any of them actually
have such a thing, though, so you may be out of luck. (I do seem to
recall that Resin has multipart requests somewhat more baked in, so it
may have something in place, but it's been a long time since I've
looked at it.)

Martin Cooper

On Mon, Dec 28, 2009 at 2:40 PM, Martin <> wrote:
> Hello,
> I am having a very frustrating problem with servletfileupload and progresslistener. I
am using commons-fileupload-1.2.1.jar and commons-io-1.4.jar. I would very much like to implement
a file upload feature which gives some feedback to the user about the progress so they don't
become impatient and give up. To do this I have attached a progresslistener to a servletfileupload
as described here:
> But I am having a very hard time getting this to work right. After much debugging I have
managed to figure out that every single call to update in the progresslistener interface takes
place during the call to upload.parseRequest(request) which typically only takes a few milliseconds
right at the very end. Currently I am uploading images which take about 5-10 seconds to upload
and during most of the upload the progress is undefined and then right at the end it jumps
to 100% which is consistent with my debugging. So my question is what am I doing wrong? How
do I get the update function in the progresslistener interface to be called periodically while
the file is being uploaded instead of only at the very end when it is being processed?
> Thanks for any help!
> Regards,
> Martin

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message