The Progress Indicator



FileUpEE includes a server-side progress indicator that allows you to log and display the progress of an upload. Note that the progress indicator monitors the whole upload, and cannot watch the progress of an individual file within an upload.

To allow file uploads, NTFS permissions must be set appropriately for FileUpEE's temporary and destination directories. For more information, see Security Considerations.

FileUpEE's progress indicator can monitor uploads from client to Web server, and from Web server to file server. The progress from client to Web server is measured as the number of bytes received on the Web server. Progress from Web server to file server is measured as the number of bytes sent from the Web server; note that this is not proof of arrival on the file server.

Example: 3-Tier Upload with A Pop-up Progress Indicator

In this 3-tier upload example, the progress indicator is displayed in a pop-up browser window. Note that WebServer.asp and FileServer.asp use the include file include.inc.asp.

Important: The example saves the upload to the folder FileUpEE\doc-samples\samples temp. The IUSR_MACHINENAME or authenticated user account must have Read, Write, and Delete access to this folder.

A 100K size limit has been set on upload samples.

The progress indicator example includes four scripts:

  • Form.asp
    The upload form.


  • Progress.asp
    The pop-up progress indicator.


  • WebServer.asp
    The Web server script. Webserver.asp includes all server-side upload processing instructions.


  • FileServer.asp
    The file server script. FileServer.asp executes the instructions that were set in WebServer.asp.


Form.asp

Form.asp contains the upload form. Form.asp creates two instances of the progress indicator for the two stages of the upload - client to Web server and Web server to file server:

	Set oFileUpEEProgressWS = Server.CreateObject("SoftArtisans.FileUpEEProgress")
	Set oFileUpEEProgressClient = Server.CreateObject("SoftArtisans.FileUpEEProgress")

The Watch property specifies the stage of the upload to monitor. In Form.asp, one progress indicator is set to monitor the upload from client to Web server (transfer stage saClient), and the other is set monitor the upload from Web server to file server (transfer stage saWebServer):

	'--- Watch the upload from client to Web server.  That is, 
	'--- monitor the upload as it is RECEIVED on the Web server.
	oFileUpEEProgressClient.Watch = saClient
	'--- Watch the upload from Web server to file server.  That  
	'--- is, monitor the upload as it is SENT FROM the Web server.
	oFileUpEEProgressClient.Watch = saWebServer

The NextProgressID method generates progress ids for both stages of the upload - client to Web server and Web server to file server:

	'--- Get a new progress ID for the client > Web server layer
	clProgID = oFileUpEEProgressClient.NextProgressID

	'--- Get a new progress ID for the Web server > file server layer
	wsProgID = oFileUpEEProgressWS.NextProgressID

The two ProgressIds generated for the two stages of the upload will be identical. The ProgressIds will be passed to WebServer.asp and to Progress.asp through the startupload() function. Clicking Upload File will call startupload(). The function submits the upload request with the progress ids to WebServer.asp, and opens the progress indicator window (Progress.asp), passing it the two progress ids:

	function startupload() 
	{
	  winstyle="height=150,width=560,status=no,scrollbars=no,toolbar=no,menubar=no,location=no";
 	  window.open("progress.asp?wprogressid=<%=wsProgID%>&cprogressid=<%=clProgID%>",null,winstyle);
	  document.theForm.action="webserver.asp?wprogressid=<%=wsProgID%>&cprogressid=<%=clProgID%>";
	}
Progress.asp

Progress.asp is the pop-up progress indicator. The upload progress is displayed within an HTML table. For each stage of the upload, the table dispays, the progress id, a visual progress indicator, the number of bytes transferred so far, the percentage of bytes transferred so far, and total bytes to transfer.

Note: The progress indicator monitors the whole upload. It does not watch the progress of an individual file within an upload.

As in Form.asp, two FileUpEEProgress are created for the two stages of the upload - client to Web server and Web server to file server. For each instance of the FileUpEEProgress object, the Watch property is set to the appropriate transfer stage (saClient or saWebServer).

	Set oFileUpProgressClient = Server.CreateObject("Softartisans.FileUpEEProgress")
	Set oFileUpProgressWS = Server.CreateObject("Softartisans.FileUpEEProgress")
	
	oFileUpProgressClient.Watch = saClient
	oFileUpProgressWS.Watch = saWebServer

The client and Web server progress ids that were submitted in the query string are passed to the appropriate FileUpEEProgress objects:

	oFileUpProgressClient.ProgressID = CInt(request.querystring("cprogressid"))
	oFileUpProgressWS.ProgressID = CInt(request.querystring("wprogressid"))
Note: The progress from client to Web server is measured as the number of bytes received on the Web server. Progress from Web server to file server is measured as the number of bytes sent from the Web server, which is not proof of arrival on the file server.
WebServer.asp

WebServer.asp runs on the Web server. It includes all upload processing information. WebServer.asp sends the upload request to the file server script set by the TargetURL property. The request to the file server is a SOAP message (an XML file).

To enable progress indication, the FileUpEE object's ProgressIndicator property must be set to True for both upload stages:

	oFileUpEE.ProgressIndicator(saClient) = True
	oFileUpEE.ProgressIndicator(saWebServer) = True

The progress ids that were submitted in the query string must be passed to the FileUpEE object's ProgressID(saClient) and ProgressID(saWebServer) properties:

	oFileUpEE.ProgressID(saClient) = CInt(request.querystring("cprogressid"))
	oFileUpEE.ProgressID(saWebServer) = CInt(request.querystring("wprogressid"))
FileServer.asp

FileServer.asp is executed on the file server. FileServer.asp does not include upload processing instructions; it automatically executes the instructions that were set in WebServer.asp and sent from the Web server as a SOAP message. FileUpEE automatically processes the request according to the SOAP message because AutoProcess - the third parameter of ProcessRequest - is set to True.

Top


Progress Indicator Methods and Properties
NextProgressIDThe NextProgressId method returns the next unused ProgressId.
PercentageThe Percentage property returns the percentage of the upload that was:
  • Received on the Web server (if the upload is from client to Web server)

    OR


  • Sent to the file server (if the upload is from Web server to file server)
ProgressIdThe ProgressId property sets or returns a progress id number for an upload.
TotalBytesThe TotalBytes property returns the total number of bytes to be uploaded.
TransferredBytesThe TransferredBytes property returns the number of bytes that were:
  • Received on the Web server (if the upload is from client to Web server)

    OR


  • Sent to the file server (if the upload is from Web server to file server)
WatchThe Watch property specifies the transfer stage that the progress indicator should watch: saClient or saWebServer.

Top


Copyright © 2003, SoftArtisans, Inc.