You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Karl Goldstein <ka...@frontleaf.com> on 2004/03/29 21:45:53 UTC

Adding a status callback to FileUpload

Hi,

I plan to try to add a status callback to the FileUpload package.  Here 
is the scenario I would like to support (I'm making this up as I go, but 
something like this):

1) User uploads a large file (form target is an invisible IFRAME so that 
the browser does not leave the form page on submit).
2) The onsubmit handler for the file upload form uses setTimeout to call 
a "checkStatus" function (in Javascript) in a few seconds.
3) The checkStatus function makes a request in an invisible IFRAME to 
the server.
4) The server responds with with a message on the status of the file upload.
5) Upon receiving a reply from the server, an onload handler in the 
IFRAME updates a visible status message on the form.
6) When the upload is complete, the onload handler displays a success 
message and moves the user to the next page (or displays an error).

To support this scenario, I plan to try and add the following to FileUpload:

1) As FileUpload processes an incoming request, it updates a session 
attribute associated with the request.  I'm assuming in most cases it 
should be possible to provide a percentage complete status, since the 
total size is available in the header even before the upload is complete.
2) A status page returned to the invisible IFRAME can check this session 
attribute and inform the client what FileUpload is doing at the moment.

Anybody thought of doing something similar?  Any thoughts on why this 
wouldn't work?  Thanks for any feedback, and unless I hear otherwise 
I'll take a shot and let you know if/when I come up with something.

Regards,

Karl Goldstein

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Adding a status callback to FileUpload

Posted by Martin Cooper <ma...@apache.org>.
See:

http://issues.apache.org/bugzilla/show_bug.cgi?id=25830

--
Martin Cooper


On Mon, 29 Mar 2004, Karl Goldstein wrote:

> Hi,
>
> I plan to try to add a status callback to the FileUpload package.  Here
> is the scenario I would like to support (I'm making this up as I go, but
> something like this):
>
> 1) User uploads a large file (form target is an invisible IFRAME so that
> the browser does not leave the form page on submit).
> 2) The onsubmit handler for the file upload form uses setTimeout to call
> a "checkStatus" function (in Javascript) in a few seconds.
> 3) The checkStatus function makes a request in an invisible IFRAME to
> the server.
> 4) The server responds with with a message on the status of the file upload.
> 5) Upon receiving a reply from the server, an onload handler in the
> IFRAME updates a visible status message on the form.
> 6) When the upload is complete, the onload handler displays a success
> message and moves the user to the next page (or displays an error).
>
> To support this scenario, I plan to try and add the following to FileUpload:
>
> 1) As FileUpload processes an incoming request, it updates a session
> attribute associated with the request.  I'm assuming in most cases it
> should be possible to provide a percentage complete status, since the
> total size is available in the header even before the upload is complete.
> 2) A status page returned to the invisible IFRAME can check this session
> attribute and inform the client what FileUpload is doing at the moment.
>
> Anybody thought of doing something similar?  Any thoughts on why this
> wouldn't work?  Thanks for any feedback, and unless I hear otherwise
> I'll take a shot and let you know if/when I come up with something.
>
> Regards,
>
> Karl Goldstein
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Adding a status callback to FileUpload

Posted by Peter Courcoux <pe...@courcoux.biz>.
Karl,

There is some stuff in bugzilla regarding Upload Progress Reporting
which supports a component I wrote to work with Turbine.

I think I left some unneeded synchronization in, which was kindly
pointed out by someone and there was also a useful additional method
suggested, from memory it was to do with getting the start time of the
upload. 

Perhaps this would work for you. I know several users who have taken my
basic code, amended it and used it with both Struts and Turbine.

Maybe we could get this polished and accepted.

Regards,

Peter

On Mon, 2004-03-29 at 20:45, Karl Goldstein wrote:
> Hi,
> 
> I plan to try to add a status callback to the FileUpload package.  Here 
> is the scenario I would like to support (I'm making this up as I go, but 
> something like this):
> 
> 1) User uploads a large file (form target is an invisible IFRAME so that 
> the browser does not leave the form page on submit).
> 2) The onsubmit handler for the file upload form uses setTimeout to call 
> a "checkStatus" function (in Javascript) in a few seconds.
> 3) The checkStatus function makes a request in an invisible IFRAME to 
> the server.
> 4) The server responds with with a message on the status of the file upload.
> 5) Upon receiving a reply from the server, an onload handler in the 
> IFRAME updates a visible status message on the form.
> 6) When the upload is complete, the onload handler displays a success 
> message and moves the user to the next page (or displays an error).
> 
> To support this scenario, I plan to try and add the following to FileUpload:
> 
> 1) As FileUpload processes an incoming request, it updates a session 
> attribute associated with the request.  I'm assuming in most cases it 
> should be possible to provide a percentage complete status, since the 
> total size is available in the header even before the upload is complete.
> 2) A status page returned to the invisible IFRAME can check this session 
> attribute and inform the client what FileUpload is doing at the moment.
> 
> Anybody thought of doing something similar?  Any thoughts on why this 
> wouldn't work?  Thanks for any feedback, and unless I hear otherwise 
> I'll take a shot and let you know if/when I come up with something.
> 
> Regards,
> 
> Karl Goldstein
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org