ProgressManager Object

Overview

The ProgressManager object is a top-lever object responsible for managing and rendering the progress indicator. See Chapter 5 for more information.

Member List

Properties

This object has no public properties.

Methods


Function CreateProgressID() As String

Returns a unique progress ID which connects the progress bar window with its respective upload form and script. This method is to be called from the file containing the upload form.

Usage:

Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
PID = "PID=" & UploadProgress.CreateProgressID()

Relevant Chapters: 5


Function FormatProgress(PID As String, ByRef Iteration As Variant, BarColor As String, FormatString As String) As String

Returns HTML code for the progress indicator, including the progress bar itself and all numeric upload parameters.

PID is the progress ID generated by the CreateProgressID method.

Iteration is an integer variable which controls how many refreshes the progress window will stay open for in case the server stops responding. In our code samples, this value is set to 10 and can be changed to a smaller or larger number.

BarColor specifies the color of the progress bar. By default, this parameter is set to "#00007F".

FormatString is a string which controls the appearance of the progress bar. It is through this parameter that you can customize the layout of the progress window and its components. The format string may contain special characters which are placeholders for various HTML tags and progress indicators.

Below is the list of possible special characters the format string may contain:

%T - the beginning of an HTML table (<table><tr><td>)
%t - the end of an HTML table (</td></tr></table>)
%d - a new column (</td><td>)
%r - a new column aligned to the right (</td><td align=right>)
%c - a new column aligned to the center (</td><td align=center>)
%l - a new row (</td></tr><tr><td>)
%n - a line break (<br>)

%Bn - the progress bar; n indicates the number of percentage points per progress square. Our sample uses %B3. For a solid progress bar, use %B0.

The following special characters are placeholders for various numeric values:

%E - elapsed time
%R - remaining time
%S - current transfer speed
%U - transferred amount
%V - total upload size
%P - percentage completed
%Y - remaining amount

By default, FormatString is set to the following value:

"%TUploading files...%t%B3%T%R left (at %S/sec) %r%U/%V(%P)%l%t"

which evaluates to the following progress bar layout:

Usage:

bar_content = UploadProgress.FormatProgress(PID, TimeO, "#00007F", format)

Relevant Chapters: 5


Function XmlProgress(PID As String) As String

Returns an XML document containing various progress data components such as remaining time, uploaded bytes, etc. This method is to be used with the Ajax-based progress bar functionality introduced in Version 3.1.

PID is the progress ID generated by the CreateProgressID method.

Usage:

Response.Write UploadProgress.XmlProgress(PID)

Relevant Section: 5.5