It is but why? The file upload takes like a second, so your progress bar
will never been seen.
Now if you were uploading the file and processing it all at the same time,
then maybe the progress bar can be seen, but just for an upload, makes no
sense due to the time it takes for it to upload.
> Hi, while the user is uploading a file, is possible to show a progress
> bar? Using VS 2005 Asp.net 2.0 C#
>
> Thanks!
The server doesn't know what size the file is until it's done uploading,
so I think your best option is to either use an animated gif to show
"something" while the upload is going on, or use AJAX. The postback
itself will contain the file, so you'll need to use client-side code to
do the displaying.
Steve C.
MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA
> Hi, while the user is uploading a file, is possible to show a progress bar?
> Using VS 2005 Asp.net 2.0 C#
>
> Thanks!
Mike - 30 Aug 2007 14:04 GMT
true, but regardless of what is used, the upload takes a second or so, so it
may never even be seen by the user.
I have an upload page and I tried adding one to it, but due to the time it
actually took to upload the file the user never saw the progress/animation
on the screen.
> The server doesn't know what size the file is until it's done uploading,
> so I think your best option is to either use an animated gif to show
[quoted text clipped - 9 lines]
>>
>> Thanks!
Steve - 30 Aug 2007 14:23 GMT
The OP didn't say anything about how large the file is. It could be a
10MB file, which would take longer than a second or two?
Steve C.
MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA
> true, but regardless of what is used, the upload takes a second or so, so it
> may never even be seen by the user.
[quoted text clipped - 15 lines]
>>>
>>> Thanks!
Paulo - 30 Aug 2007 14:36 GMT
The file size may vary, example if the size is 10MB @ 10/KBs will take ~
5mins... I dont know the user bandwidth... so I would like to show to him
some progress..
Thanks!
> The OP didn't say anything about how large the file is. It could be a 10MB
> file, which would take longer than a second or two?
[quoted text clipped - 21 lines]
>>>>
>>>> Thanks!
Mike - 30 Aug 2007 14:49 GMT
then yeah you can use an atlas window to show the progress, etc.
> The file size may vary, example if the size is 10MB @ 10/KBs will take ~
> 5mins... I dont know the user bandwidth... so I would like to show to him
[quoted text clipped - 27 lines]
>>>>>
>>>>> Thanks!
Juan T. Llibre - 30 Aug 2007 15:17 GMT
re:
!> The server doesn't know what size the file is until it's done uploading
Indeed.
re:
!> so I think your best option is to either use an animated gif to show
!> "something" while the upload is going on, or use AJAX.
Another option would be to use an animated GIF to keep the user
entertained while the upload finishes and create a FileSystemWatcher
object to redirect the user to "uploadFinished.aspx" when the file has finished uploading.
To do that, you'll have to import the FileSystemWatcher namespace :
System.IO.FileSystemWatcher
Something like this ?
public void CreateWatcher()
{
//Create a new FileSystemWatcher
FileSystemWatcher watcher = newFileSystemWatcher();
//Set the filter to only catch ZIP files.
watcher.Filter = "*.zip";
// Perhaps a variable could be created to hold the exact name
// of the file in the filter, obtained from the File.Upload textbox.
//Subscribe to the Created event.
watcher.Created += new FileSystemEventHandler(watcher_FileCreated);
//Set the monitored path to your upload directory
watcher.Path = @"C:\Temp\";
//Enable the FileSystemWatcher events.
watcher.EnableRaisingEvents = true;
}
void watcher_FileCreated(object sender, FileSystemEventArgs e)
{
//When the .zip file has been created in C:\Temp\ ...
Response.Redirect("~/uploadFinished.aspx", false);
return;
}
I haven't done this...but it seems quite possible.
If you try it, please let us know if it worked.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> The server doesn't know what size the file is until it's done uploading, so I think your best option is to either use
> an animated gif to show "something" while the upload is going on, or use AJAX. The postback itself will contain the
[quoted text clipped - 6 lines]
>>
>> Thanks!
> Hi, while the user is uploading a file, is possible to show aprogressbar?
> Using VS 2005Asp.net2.0 C#
Yes. There are several file upload progress bar components available,
including my open-source NeatUpload component:
http://www.brettle.com/neatupload
--Dean