file uploads with progress bar

  • Thread starter Thread starter Todd Denlinger
  • Start date Start date
T

Todd Denlinger

Ok,

I know how to upload a file in asp.net using the <input
type="file" runat="server"> control. What I don't know
how to do is monitor the progress of the upload so that I
can show the end-user a progress bar, or something.

Anyone have any ideals or can point me to a sample?

Thanks,
Todd
 
I don't think there is an easy way to do this. There are companies that sell
components with progress bars for uploads.

I believe SoftArtisans is one of them, and there are a few others as well.
visit www.asp.net, and maybe search on google to find them.
 
Thanks Marina

You may be right, a progress bar may be fairly complex.
However, it looks like you can open another window using
javascript and
<form id="Upload" method="post" runat="server"
onsubmit="OnUpload()">

then closing the javascript window after the upload by using

<body ms_positioning="FlowLayout" onunload="OnUnload()">

It wouldn't be a progress bar, but you'd have an animated
gif at least.

Regards,
Todd
 
Hi todd,

I agree with Marina that there may not be an easy way to implement in
ASP.NET. Since the Progress bar locate on client side, it needs to
communicate with server side to determine the progress. However, when you
upload a file, you just send a request to server side and wait for
response. There is no channel for transfering progress information during
upload.

Normally, there are two weak work around for this issue:

1. Embeding some third party ActiveX control in the web page and use it to
upload file. The third party activex control will upload the file with
sockets and display a progress bar.

2. Display a mendacious progress bar like a GIF picture, or a progress bar
like:

For i=1 to 10000

Progressbar.position= Progressbar.position+1
loop

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Agreed, you could do that. But I don't think there would be an easy way to
actually judge the progress of the upload - as in, how much of it went up.

But yes, you could put an animated image up until the upload was complete...
 
I have tried this idea and I think it might work. but could you give a more
complete example of the code in both pages. I have been able to open the new
window but how do I close it when the upload is finished. Also what stops
the progress bar from being displayed if the form is invalid.
 
One more solution which might be helpful is to have a anim gif within a
layer and the form within another layer. Hide the form layer and make the
layer containing anim gif visible when the submit button is clicked. In this
case you don't need to open a pop up window.

Reddy
 
Ok then, How do I do that. I would like to see the code to produce one of
these results.
 
Back
Top