Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 1115
Product
FileUp
Version
5.x
Title
Closing the progress indicator window automatically
Problem
Can I make the progress indicator window close automatically when an upload is complete?
Solution

Yes. By adding some client-side JavaScript to the progress indicator, it can close itself automatically when an upload is complete.

The progress indicator samples that come with FileUp can be modified to make the progress indicator window close automatically. (These samples are installed to C:\Program Files\SoftArtisans\FileUp\samples\UploadSamples\ProgressIndicator\ by default.)

You can modify one of the existing progress indicator pages by doing the following:

1.) First, add the following JavaScript function to the <head> of the progress page that checks whether the transfer is complete and closes the window if it is.

Note: The "bDone" variable in the ASP example and the "strPercent" variable in the ASP.NET example already exist in our samples and are used to determine whether the progress window should refresh itself. This code simply uses those same values to determine when the transfer is complete so that the window can be closed.

ASP - progress.asp


<script language="JavaScript">
<!--
// Get transfer status from ASP variable
var transferComplete = "<%=bDone%>";

function checkStatus() {
	// If transfer is complete, close window
	if (transferComplete == "True") {
		window.close();
	}
}
-->
</script>

ASP.NET (C# or VB.NET) - ProgressIndicator.aspx


<script language="JavaScript">
<!--
// Get transfer status from ASP.NET variable
var percentComplete = "<%=strPercent%>";

function checkStatus() {
	// If transfer is complete, close window
	if (percentComplete == "100.00%") {
		window.close();
	}
}
-->
</script>

2.) Then, call this function from the onLoad event of the <body>:


<Body onLoad="checkStatus();">

A version of the progress indicator page is attached to this KB article that contains these modifications, both in ASP and ASP.NET. You can simply replace progress.asp or ProgressIndicator.aspx in our original samples with these versions.

Attachments
Attachments/KB1115_files1.zip
Created : 6/30/2005 6:14:19 PM (last modified : 6/30/2005 6:14:18 PM)
Rate this article!
Comments