commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mart...@apache.org>
Subject Re: problems using progresslistener with servletfileupload
Date Mon, 28 Dec 2009 23:10:03 GMT
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 <jackdoozer@yahoo.com> 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:
>
> http://commons.apache.org/fileupload/using.html
>
> 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: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message