A simpler solution that may still meet your needs might be to use an
animated GIF on a pop-up just to give the user some feedback that the upload
is still in progress and that they should be patient.

You could setup something like this:

The HTML form with upload file input element has a hidden field with some
UUID generated by the Action. The UUID is just some unique ID to avoid
having two upload forms with the same ID. For instance, the session-id or
perhaps session-id+current_time would work fine for a UUID.

Have the javascript onSubmit for the form pop-up a window, where the content
of that window will be /uploadStatus.do?UUID=234344.

Your /uploadStatus.do action will look for the UUID and forward to a JSP
with the animated GIF in it if that file has not completed uploading. That
JSP will have a meta-refresh in it that will refresh the content of the
pop-up every few seconds.

The form submit with the file upload input element will be uploading the
file for a while. When it finishes, it will indicate that the file upload
with UUID=234344 has completed to some server-side upload-tracking
subsystem. Then it will forward or redirect to whatever page the user should
see when the upload completes.

The pop-up status window will refresh itself within a second or two, and the
/uploadStatus.do action will determine that the upload for the file with
UUID=234344 has completed (by checking with the server-side upload-tracking
subsystem). It will then forward to a JSP that closes the pop-up window or
shows a message that the upload has completed.


This isn't a progress bar, but it should be easier to implement. You could
even use a fast-cycling animated GIF that looks like a progress bar (but
doesn't really relate to the actual % progress) if that would satisfy your
UI design requirements.

-Max

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 19, 2004 1:31 AM
Subject: File-Upload: Progress-Bar


Hello everybody!

I'm up to the task to implement a progress bar for File-Uploads, cause the
files that are uploaded to my Webapp can be quite large.
Well as usual this problem is not easily solved on the HTTP-Browser upload
side.

I'm using Struts here so I'm also using the commons/FileUpload. I was
planning to do it that way that I assign a unique number to every
session's-upload and keep the current status of an upload in a singleton for
access. In an additional frame (with refresh) I would like to show the
progress bar.

My question: Has anybody done something like this with Struts before and can
give me some little advise? Or more specific: Is it possible to first get
the complete filesize from the FormFiles and the do the real Upload during
the Action (keeping track of the read bytes)

Thx for every help!!

_______________________________________
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
[EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to