|
The progress bar is slightly more complicated.
Because data will be being uploaded at the same time as the progress
bar page is being refreshed we have to disable session state via
an ASP processing directive on the first line.
We insert meta-tags to ensure that the page refreshes itself every
couple of seconds. We create an XProgress object and set the ID
to the unique ID we were passed in the URL. This synchronizes the
XProgress object with the matching XForm object.
We want to close the progress window once the transfer has been
completed so we put in a simple piece of client side JavaScript
to do this. The rest of the form simply reports to the user the
information retrieved via the XProgress object. The progress bar
itself is simply a table containing a colored cell of a particular
width.
<%@EnableSessionState=False%>
<html>
<head>
<title>Progress...</title>
<meta http-equiv="expires" content="Tue, 01 Jan
1981 01:00:00 GMT">
<meta http-equiv=refresh content="2,progressbar.asp?ID=<%=Request.QueryString("ID")%>">
<%
On Error Resume Next
Set theProgress = Server.CreateObject("ABCUpload4.XProgress")
theProgress.ID = Request.QueryString("ID")
%>
<script language="javascript">
<!--
if (<% =theProgress.PercentDone %> == 100) top.close();
//-->
</script>
</head>
<body bgcolor="#CCCCCC">
<table border="0" width="100%">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="2"><b>Uploading:</b></font></td>
</tr>
<tr bgcolor="#999999">
<td>
<table border="0" width="<%=theProgress.PercentDone%>%"
cellspacing="1" bgcolor="#0033FF">
<tr>
<td><font size="1"> </font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Estimated time left:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">
<%=Int(theProgress.SecondsLeft / 60)%> min
<%=theProgress.SecondsLeft Mod 60%> secs
(<%=Round(theProgress.BytesDone / 1024, 1)%> KB of
<%=Round(theProgress.BytesTotal / 1024, 1)%> KB uploaded)</font></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">
Transfer Rate:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">
<%=Round(theProgress.BytesPerSecond/1024, 1)%> KB/sec</font></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Information:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><%=theProgress.Note%></font></td>
</tr>
</table>
</td>
</tr>
<tr></tr>
</table>
</body>
</html>
|
|
|