A 3-Tier Upload


FileUpEE can perform a browser-to-server-to-server (3-tier) upload, allowing you to maintain a secure file server that is isolated from your public Web server.

The client-to-server part of the file transfer is a form-based file upload . This type of upload submits form data (the file and/or other form elements) as name/value pairs. FileUpEE processes the upload on the Web server.

As in almost all 3-tier uploads, in the following example FileUpEE submits the server-to-server part of the file transfer as a SOAP request with an attachment . SOAP (Simple Object Access Protocol) is an Internet protocol that uses HTTP as its transport and XML as its data format. A SOAP request is submitted in an XML document (the XML payload) via HTTP. Unlike in a form-based upload request, the XML payload can contain application logic and instructions to be executed on the file server.

When scripting a 3-tier upload, you can include all upload processing instructions on the Web server, as you would in a browser-to-server upload. If the request from Web server to file server includes all processing instructions, these can be executed automatically on the file server. Alternatively, you can put the processing instructions on the file server, to protect important paths and database information.

FileUpEE usually handles uploads from Web server to file server as SOAP messages with attachments, but can process server to server uploads according to RFC 1867, as in the example 3 Tier Upload with Standard FileUp.
To allow file uploads, NTFS permissions must be set appropriately for FileUpEE's temporary and destination directories. For more information, see Security Considerations.

Example 1: Upload a File from Client to Web Server to File Server

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

The following example uploads a file from a Web form. The file is first sent to a Web server, and then to a file server, where it is saved. All upload processing instructions (such as the destination directory) are in the Web server page. The instructions are executed automatically on the file server.

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 Modify access to FileUpEE\doc-samples\samples\temp.

To run the example:

  1. Click the link Run sample.


  2. Browse to select a file to upload, and click Upload.


ScriptDescription
Client script: form2.htm Form2.htm defines a Web form that includes a file input field (<input type="file">) and a Submit button.

Top

Web Server script: ws.asp Ws.asp runs on the Web server. It includes all upload processing information: the save method (directory or database), save location, etc.

Ws.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).
The TransferStage Property
TransferStage specifies the stage of an upload, which may be either Web server or file server. Always set the TransferStage property. Set this property immediately after creating an instance of FileUpEE. In ws.asp, the property is set to saWebServer:
	objFileUpEE.TransferStage = saWebServer
The ProcessRequest Method
In ws.asp, ProcessRequest takes the Request object and the default values for SOAPRequest and AutoProcess (False and False):
	objFileUpEE.ProcessRequest Request, False, False
SOAPRequest is set to False, indicating that the request to ws.asp is a form-based file upload, not a SOAP request. AutoProcess is set to False, because ws.asp will not automatically execute instructions in a SOAP message. If SOAPRequest is False, AutoProcess must be set to False.
The TargetURL Property
When sending a request from server to server you must set TargetUrl. This property specifies the page on the file server to which FileUpEE will submit the request.
The SendRequest Method
SendRequest sends the upload request to fs.asp on the file server.

Top

File Server script: fs.asp Fs.asp is executed on the file server. Fs.asp does not include upload processing instructions; it automatically executes the instructions that were set in ws.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.

The TransferStage Property
TransferStage specifies the stage of an upload, which may be either Web server or file server. Always set the TransferStage property. Set this property immediately after creating an instance of FileUpEE. In fs.asp, the property is set to saFileServer:
	objFileUpEE.TransferStage = saFileServer
The ProcessRequest Method
In fs.asp, ProcessRequest takes the Request object, and True for both SOAPRequest and AutoProcess:
	objFileUpEE.ProcessRequest Request, True, True
SOAPRequest is set to True, indicating that the request from ws.asp is a SOAP request, not a form-based file upload. AutoProcess is set to True, which tells FileUpEE to automatically process the request according to the SOAP payload (the XML document tranferred with a SOAP request). Note: Do not set AutoProcess to True unless the Web server script contains all necessary processing instructions.
The SendResponse Method
SendResponse takes the Response object and sends it to ws.asp on the Web server. Note that the response to the browser was set in ws.asp.

Top


Example 2: Upload a File from Client to Web Server to File Server and Display Upload Properties

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

This sample uploads a file and displays properties of the uploaded file. Note that WebServer.asp uses 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 Modify access to FileUpEE\doc-samples\samples\temp.

To run the example:

  1. Click the link Run sample.


  2. Browse to select a file to upload, and click Upload.


Top


Copyright © 2003, SoftArtisans, Inc.