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.
FileUpEE submits the server-to-server part of the file transfer as a SOAP message 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 a form-based upload request - which can only include name/value pairs - the XML payload can contain a much richer, hierarchical set of data.
When scripting a 3-tier upload, you can include all upload processing instructions on the Web server, as you would in a client-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.
To allow file uploads, NTFS permissions must be set appropriately for FileUpEE's temporary and destination directories. For more information, see Security Considerations. |
The following ASP tutorial demonstrates 3-tier uploading with FileUpEE. The tutorial's application 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 directions (such as the destination directory) are in the web server page. These directions are executed by FileUpEE on the file server if automatic file processing is selected (as it is in the following tutorial).
The client-side page defines a web form that is used to upload the file from the client to the web server. The web form submitting the file must contain:
<form>
ACTION
attribute that calls the upload
processing script on the server.<form>
tag attribute ENCTYPE="multipart/form-data"
.<input type="file">
tag, including a name
attribute.
The web server page includes all upload processing directions: the save method (FileUpEE
can save to either a directory or a database), save location, and other properties. FileUpEE sends
the upload request from the web server to the file server page specified by the
TargetUrl
property. The upload request from web server to file server
is a SOAP message with an attachment. The SOAP request (an XML file) contains all
the processing directions specified on the web server. These directions are executed
by FileUpEE on the file server if automatic file processing is selected (as it is
in the following tutorial).
The following VBScript lines receive the upload on the web server, set instructions to be executed on the file server (the upload's final destination), and send the upload (as a SOAP request) to the file server:
Set oFileUpEE = Server.CreateObject("SoftArtisans.FileUpEe")
FileUpEE
.
oFileUpEE.TransferStage
= saWebServer
TransferStage
property specifies the stage of the file upload,
that is, the server on which the current code should run. The transfer stage can
be set to saWebServer
or saFileServer
. The TransferStage
property is required. Set this property immediately after creating an instance of
FileUpEE.oFileUpEE.ProcessRequest
Request, False, False
ProcessRequest
method passes the Request object to FileUpEE. The
collection of transferred files is not available until after ProcessRequest
is called. In addition to the ASP Request object, ProcessRequest
takes
two boolean parameters:
SoapRequest | |||
---|---|---|---|
The SoapRequest parameter tells FileUpEE whether the file transfer
is a SOAP request or not. Since the web server receives a form-based request and
not a SOAP request, SoapRequest is set to false .
|
|||
AutoProcess | |||
If the AutoProcess parameter is set to true , FileUpEE will
process the Request according to the SOAP payload (the XML document transferred with
a SOAP request), and it is not required to "manually" save the files by calling
FileEe.Save
in the script that passes true as the AutoProcess parameter
of ProcessRequest . AutoProcess can only be true
if the script is processing a SOAP request. The web server is processing a form-based
file upload, not a SOAP request, so AutoProcess must be false . |
oFileUpEE.DestinationDirectory
= Server.MapPath("/FileUpEE/Samples/temp")
Set oFile = oFileUpEE.Files
("myFile")
FileEE
object
which represents the uploaded file. "myFile"
is the name of the file
input field in the form that submitted the upload.
oFileUpEE.TargetUrl
= "http://localhost/FileUpEE/Samples/UploadSamples/Basic/Simple3Tier/ASP/fileserver.asp"
TargetUrl
.
This property specifies the url of the page on the file server to which FileUpEE
will submit the request.
oFile.DestinationFileName
= oFile.ClientFileName
DestinationFileName
property sets the name with which to save the
uploaded file. In this case, the name is set to the file's original name on the
client.
intSAResult = oFileUpEE.SendRequest
()
The file server code does not include upload processing instructions, because it automatically executes the instructions that were set on the web server and sent to the file server as a SOAP request.
Set oFileUpEe = Server.CreateObject("SoftArtisans.FileUpEe")
FileUpEE
.
oFileUpEE.TransferStage
= saFileServer
TransferStage
property specifies the stage of the file upload,
that is, the server on which the current code should run. The transfer stage can
be client, web server, or file server. The transfer stage can be set to saWebServer
or saFileServer
. The TransferStage
property is required.
Set this property immediately after creating an instance of FileUpEE.oFileUpEe.ProcessRequest
Request, True, True
ProcessRequest
method passes the Request object to FileUpEE. The
collection of transferred files is not available until after ProcessRequest
is called. In addition to the ASP Request object, ProcessRequest
takes
two boolean parameters:
SoapRequest | |||
---|---|---|---|
The SoapRequest parameter tells FileUpEE whether the file transfer
is a SOAP request or not. Since the file server receives a SOAP request from the
web Server, SoapRequest is set to true . Note that in almost
all cases, server-to-server FileUpEE file transfers are SOAP requests. |
|||
AutoProcess | |||
If the AutoProcess parameter is set to true , FileUpEE will
process the Request according to the SOAP payload (the XML document tranferred with
a SOAP request), and it is not required to "manually" save the files by calling
FileEe.Save
in the script that passes true as the AutoProcess parameter
of ProcessRequest . AutoProcess can only be true
if the script is processing a SOAP request. Since all upload processing instructions
for the file server were included in the web server code, in the file server page
AutoProcess is set to true . |
oFileUpEe.SendResponse
Response
In ASP, Typelibs provide quick and convenient access to constants associated with
a particular object. The web server script in this example includes FileUpEE's TypeLib
because the script uses constants (e.g,
saWebServer
). The UUID attribute specifies FileUpEE's unique
identifier.
<!--METADATA TYPE="TypeLib" UUID="{6B16F98B-015D-417C-9753-74C0404EBC37}"-->