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/
======================================