|
|
The FileUpEE Object
The FileUpEE object is a file-transfer control, that performs both
form-based file uploads and server-to-server SOAP transfers, enabling uploads from
browser to Web-server to file-server.
To create an instance of FileUpEE, use:
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
See Also
Form-based File Upload in HTML
and
SOAP Messages with Attachments .
| FileUpEE Properties |
| AuditLogDatabase |
Syntax
objFileUpEE.AuditLogDatabase(SATransferStage) [= Database Connection String]
Description
When AuditLogDestination is set to saLogDatabase,
FileUpEE will save log records in a database.
AuditLogDatabase sets the connection string for FileUpEE's audit log database.
FileUpEE will save audit logs in a database if AuditLogDestination
is set to saLogDatabase.
AuditLogDatabase is a Read/Write property.
Use the database FileUpEEWS.mdb
for audit logging on the Web server, and FileUpEEFS.mdb for audit logging on
the file server. You will find these databases in
doc-samples\samples\asp\resume. To see the audit log, open the table FileUpEE.
The State column contains an SAUploadState value.
| SAUploadState Values |
saTransferComplete | 0 |
saTransferConnecting | 1 |
saTransferTransferring | 2 |
saTransferSuspended | 3 |
saTransferError | 4 |
saTransferCancelled | 5 |
saTransferIncomplete | 6 |
saTransferNotStarted | 7 |
Parameter
AuditLogDatabase takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Note
When audit logging is on, FileUpEE will create an audit
log record for each file transfer. On a busy system, this can make the destination very
large. If you enable logging, remember to delete old items in the log destination.
See Also
AuditLogDestination,
AuditLogFile,
ErrorLogDatabase,
ErrorLogDestination, and
ErrorLogFile.
Example
objFileUpEE.AuditLogDestination(saWebServer) = saLogDatabase
objFileUpEE.AuditLogDatabase(saWebServer) = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=C:\FileUpEE\FileUpEEWS.mdb;" & _
"Persist Security Info=False"
Top |
| AuditLogDestination |
Syntax
objFileUpEE.AuditLogDestination(SATransferStage) [= Audit Log Type as SALogDestination]
Description
AuditLogDestination sets the type of audit logging that FileUpEE
will use. By default, FileUpEE will not create an audit log. To enable audit
logging, set AuditLogDestination to an SALogDestination.
When audit logging is enabled, FileUpEE will create an audit log for each file
transfer. FileUpEE will record:
- When the request from the previous stage (client, Web server, or file server) began.
- When the request from the previous stage completed.
- When the upload to the next stage began.
- When the upload to the next stage completed.
- When the response from the next stage was received.
- When the response to the previous stage began.
- When the response to the previous stage completed.
AuditLogDestination is a Read/Write property.
Set AuditLogDestination to an SALogDestination:
| SALogDestination Values |
saNoLog | 0 (Default value) | FileUpEE will not create an
Audit log. |
saLogFile | 1 | The audit log will be a
file set by the property
AuditLogFile. |
saLogDatabase | 2 | FileUpEE will save log records
in a database set by the property
AuditLogDatabase. |
saEventLog | 4 | File transfers will
be logged in the Windows EventLog.
To view the log go to
Start/Control Panel/Administrative Tools/Event Viewer. |
saDebugString | 8 | File transfers will be logged in the
system debugger. You can view the records
with tools such as Sysinternals
DebugView .
|
If AuditLogDestination is set to saLogFile, set
AuditLogFile. If AuditLogDestination
is set to saLogDatabase, set
AuditLogDatabase.
Parameter
AuditLogDestination takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Note
When audit logging is on, FileUpEE will create an audit
log for each file transfer. On a busy system, this can make the destination very
large. If you enable logging, remember to delete old items in the log destination.
This is particularly important when logging to a database or to Windows EventLog.
See Also
AuditLogDatabase,
AuditLogFile,
ErrorLogDatabase,
ErrorLogDestination, and
ErrorLogFile.
Example
oFileUpEE.AuditLogDestination(saWebServer) = saLogFile
oFileUpEE.AuditLogFile(saWebServer) = "D:\FileUpEE\auditlog.txt"
Top |
| AuditLogFile |
Syntax
objFileUpEE.AuditLogFile(SATransferStage) [= Audit Log Path as String]
Description
AuditLogFile sets the path and file name of FileUpEE's audit log file.
When audit logging is enabled, FileUpEE will create an audit log for each file
transfer. FileUpEE will save the audit log to a file if
AuditLogDestination
is set to saLogFile.
AuditLogFile is a Read/Write property.
Parameter
AuditLogFile takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
See Also
AuditLogDatabase,
AuditLogDestination,
ErrorLogDatabase,
ErrorLogDestination, and
ErrorLogFile.
Example
oFileUpEE.AuditLogDestination(saWebServer) = saLogFile
oFileUpEE.AuditLogFile(saWebServer) = "D:\FileUpEE\auditlog.txt"
Top |
| ConnectTimeout |
Syntax
objFileUpEE.ConnectTimeout [= Timeout in Seconds as Long]
Description
ConnectTimeout sets a time-out value, in seconds, for server connection
requests. If a connection request takes longer than this value, the request
will be cancelled. The default value of ConnectTimeout is 40 seconds.
ConnectTimeout is a Read/Write property.
Example
objFileUpEE.ConnectTimeout = 60
Top |
| ContentType |
Syntax
objFileUpEE.ContentType [= MIME Content-Type as String]
Description
ContentType specifies the transferred
data's MIME content type (e.g., text/plain, application/msword, image/jpeg,
application/pdf).
ContentType is a Read/Write property.
Top |
| DbConnection |
Syntax
objFileUpEE.DbConnection [= Connection String]
Description
Use DbConnection
to set the database connection string when transferring files to
or from a database.
DbConnection is a Read/Write property.
See Also
Per-upload database properties: FileUpEE.DbPrimaryKey,
FileUpEE.DbPrimaryKeyValue,
FileUpEE.DbSqlCommand,
FileUpEE.DbTableName and
FileUpEE.SaveMethod.
Per-file database properties:
FileEE.DbConnection,
FileEE.DbFileColumnName,
FileEE.DbPrimaryKey,
FileEE.DbPrimaryKeyValue,
FileEE.DbSqlCommand,
FileEE.DbTableName,
FileEE.SaveAsBlob,
FileEE.SaveMethod, and
FileEE.DbSchema.
Example
objFileUpEE.DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Uploads\Images.mdb;" & _
"Persist Security Info=False"
Top |
| DbPrimaryKey |
Syntax
objFileUpEE.DbPrimaryKey [= Primary Key Column Name]
Description
DbPrimaryKey sets or returns a database table's
primary key column name.
When uploading files to a database, to update a row,
you must set
DbPrimaryKey and DbPrimaryKeyValue.
Do not set these values to add a row.
DbPrimaryKey is a Read/Write property.
See Also
Per-upload database properties:
FileUpEE.DbConnection,
FileUpEE.DbPrimaryKeyValue,
FileUpEE.DbSqlCommand,
FileUpEE.DbTableName, and
FileUpEE.SaveMethod.
Per-file database properties:
FileEE.DbConnection,
FileEE.DbFileColumnName,
FileEE.DbPrimaryKey,
FileEE.DbPrimaryKeyValue,
FileEE.DbSqlCommand,
FileEE.DbTableName,
FileEE.SaveAsBlob,
FileEE.SaveMethod, and
FileEE.DbSchema.
Example
<% ...
objFileUpEE.DbTableName = "Files"
objFileUpEE.DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE.DbPrimaryKey = "FileId"
objFileUpEE.DbPrimaryKeyValue = "6325"
...%>
Top
|
| DbPrimaryKeyValue |
Syntax
objFileUpEE.DbPrimaryKeyValue [= Primary Key Value]
Description
DbPrimaryKeyValue sets or
returns a database record's primary key value.
When uploading a file to a database, to update a row, you must set
DbPrimaryKeyValue and
DbPrimaryKey. Do not set these values to
add a row.
When downloading a file from database, you must set
DbPrimaryKeyValue for the record containing the file.
DbPrimaryKeyValue is a Read/Write property.
See Also
Per-upload database properties:
FileUpEE.DbConnection,
FileUpEE.DbPrimaryKey,
FileUpEE.DbSqlCommand,
FileUpEE.DbTableName, and
FileUpEE.SaveMethod.
Per-file database properties:
FileEE.DbConnection,
FileEE.DbFileColumnName,
FileEE.DbPrimaryKey,
FileEE.DbPrimaryKeyValue,
FileEE.DbSqlCommand,
FileEE.DbTableName,
FileEE.SaveAsBlob,
FileEE.SaveMethod, and
FileEE.DbSchema.
Example
<% ...
objFileUpEE.DbTableName = "Files"
objFileUpEE.DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE.DbPrimaryKey = "FileId"
objFileUpEE.DbPrimaryKeyValue = "6235"
...%>
Top |
| DbSqlCommand |
Syntax
objFileUpEE.DbSqlCommand [= SQL Query]
Description
Use DbSqlCommand to set a
SQL query when transferring files to or from a database.
DbSqlCommand is a Read/Write property.
See Also
Per-upload database properties:
FileUpEE.DbConnection,
FileUpEE.DbPrimaryKey,
FileUpEE.DbPrimaryKeyValue,
FileUpEE.DbTableName, and
FileUpEE.SaveMethod.
Per-file database properties:
FileEE.DbConnection,
FileEE.DbPrimaryKey,
FileEE.DbPrimaryKeyValue,
FileEE.DbSqlCommand,
FileEE.DbTableName,
FileEE.SaveAsBlob,
FileEE.SaveMethod, and
FileEE.DbSchema.
Example
<% ...
objFileUpEE.DbTableName = "Files"
objFileUpEE.DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE.DbPrimaryKey = "FileId"
objFileUpEE.DbPrimaryKeyValue = "6325"
...%>
Top |
| DbTableName |
Syntax
objFileUpEE.DbTableName [= Database Table Name]
Description
When uploading files to a database,
set DbTableName to the destination table for your upload.
When downloading files from a database,
set DbTableName to the table containing the files to download.
To set the destination table for an individual file in an upload, use
FileEE.DbTableName.
DbTableName is a Read/Write property.
See Also
Per-upload database properties:
FileUpEE.DbConnection,
FileUpEE.DbPrimaryKey,
FileUpEE.DbPrimaryKeyValue,
FileUpEE.SaveMethod, and
FileUpEE.DbSqlCommand.
Per-file database properties:
FileEE.DbConnection,
FileEE.DbPrimaryKey,
FileEE.DbPrimaryKeyValue,
FileEE.DbSqlCommand,
FileEE.DbTableName,
FileEE.SaveAsBlob,
FileEE.SaveMethod, and
FileEE.DbSchema.
Example
<% ...
objFileUpEE.SaveMethod = saDatabase
objFileUpEE.DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Uploads\files.mdb;" & _
"Persist Security Info=False"
'--- DbTableName specifies the upload's destination table in the database
objFileUpEE.DbTableName = "Images"
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
objFileUpEE(1).DbSchema.Add "ContentId", fileUp(1).ContentId
... %>
Top |
| DestinationDirectory |
Syntax
objFileUpEE.DestinationDirectory [= Directory Path]
Description
To save all files in
a file transfer to one directory, set DestinationDirectory
to the destination directory path.
If you set DestinationDirectory,
set each file's DestinationFileName.
Alternatively, use DestinationPath to set
both the directory and file name of an individual file.
You may include or omit the destination path's ending backslash; both of the following
assignments will work:
objFileUpEE.DestinationDirectory = "C:\Uploads\"
objFileUpEE.DestinationDirectory = "C:\Uploads"
DestinationDirectory is a Read/Write property.
Example
objFileUpEE.DestinationDirectory = "C:\Uploads\Images\"
objFileUpEE(0).DestinationFileName = "image1.jpg"
objFileUpEE(1).DestinationFileName = "image2.jpg"
objFileUpEE(2).DestinationFileName = "image3.jpg"
Top |
| DynamicAdjustScriptTimeout |
Syntax
objFileUpEE.DynamicAdjustScriptTimeout(SATransferStage) [= Boolean]
Description
The default ScriptTimeout value in IIS is 90 seconds.
In a file upload, the ASP page must execute for the duration of the
upload. If your user is transferring information over a slow line or is
transferring a large quantity of information, it is easy to exceed this limit.
If DynamicAdjustScriptTimeout is set to True, the IIS
ScriptTimeout value will increase automatically, as long as new data is coming
from the browser.
DynamicAdjustScriptTimeout is a Read/Write property.
Note
You can either enable DynamicAdjustScriptTimeout in script, or
in the Windows Registry Editor. To change the
DynamicAdjustScriptTimeout registry key value:
- From the Start menu, select Run....
- Enter regedit and click Ok.
- Open HKEY_LOCAL_MACHINE\SOFTWARE\SoftArtisans\FileUpEe\Parameters.
- Right-click DynamicAdjustScriptTimeout, and select Modify.
- In the Value data field, enter 1.
See Also
To use DynamicAdjustScriptTimeout under ASP.NET, you must set
FileUpEE.Page.
Example
objFileUpEE.DynamicAdjustScriptTimeout(saWebServer)
Top |
| Error |
Syntax
objFileUpEE.Error [= Error Message as String]
Description
Error sets or returns a FileUpEE error
message.
Error is a Read/Write property.
Example
Response.Write objFileUpEE.Error
Top |
| ErrorLogDatabase |
Syntax
objFileUpEE.ErrorLogDatabase(SATransferStage) [= Error Database Connection String]
Description
ErrorLogDatabase sets the connection string for FileUpEE's error database.
FileUpEE will log errors in a database if ErrorLogDestination
is set to saLogDatabase.
Use the database FileUpEEWS.mdb for error logging on the Web server, and FileUpEEFS.mdb
for error logging on the file server. You will find these databases in
doc-samples\samples\asp\resume. To see the audit log, open the Errors table.
ErrorLogDatabase is a Read/Write property.
Parameter
ErrorLogDatabase takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
See Also
AuditLogDatabase,
AuditLogDestination,
AuditLogFile,
ErrorLogDestination, and
ErrorLogFile.
Example
objFileUpEE.ErrorLogDestination(saWebServer) = saLogDatabase
objFileUpEE.ErrorLogDatabase(saWebServer) = "Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Data Source=C:\FileUpEE\FileUpEEWS.mdb;" & _
"Persist Security Info=False"
Top |
| ErrorLogDestination |
Syntax
objFileUpEE.ErrorLogDestination(SATransferStage) [= Error Log Type as SALogDestination]
Description
ErrorLogDestination sets the type of error logging that FileUpEE
will use. By default, FileUpEE will not create an error log. To enable error
logging, set ErrorLogDestination to an SALogDestination.
If ErrorLogDestination is set to saLogFile, set
ErrorLogFile. If ErrorLogDestination
is set to saLogDatabase, set
ErrorLogDatabase.
ErrorLogDestination is a Read/Write property.
Set ErrorLogDestination to an SALogDestination:
| SALogDestination Values |
saNoLog | 0 (Default value) | FileUpEE will not create an
Error log. |
saLogFile | 1 | Errors will be logged in
the file set by the property
ErrorLogFile. |
saLogDatabase | 2 | Errors will be logged in
a database set by the property
ErrorLogDatabase. |
saEventLog | 4 | Errors will be logged in
the Windows EventLog.
To view the errors go to
Start/Control Panel/Administrative Tools/Event Viewer. |
saDebugString | 8 | Errors will be logged in the
system debugger. You can view the errors
with tools such as Sysinternals
DebugView .
|
Parameter
ErrorLogDestination takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
See Also
AuditLogDatabase,
AuditLogDestination,
AuditLogFile,
ErrorLogDatabase, and
ErrorLogFile.
Example
objFileUpEE.ErrorLogDestination(saWebServer) = saLogDatabase
objFileUpEE.ErrorLogDatabase(saWebServer) = "Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Data Source=C:\FileUpEE\FileUpEEWS.mdb;" & _
"Persist Security Info=False"
Top |
| ErrorLogFile |
Syntax
objFileUpEE.ErrorLogFile(SATransferStage) [= Error Log Path as String]
Description
ErrorLogFile sets the path and file name of FileUpEE's error log file.
FileUpEE will log errors in a file if ErrorLogDestination
is set to saLogFile.
ErrorLogFile is a Read/Write property.
Parameter
ErrorLogFile takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
See Also
AuditLogDatabase,
AuditLogDestination,
AuditLogFile,
ErrorLogDatabase, and
ErrorLogDestination.
Example
objFileUpEE.ErrorLogDestination(saWebServer) = saLogFile
objFileUpEE.ErrorLogFile(saWebServer) = "C:\FileUpEE\ErrorLog.txt"
Top |
| Files |
Syntax
objFileUpEE.Files
Description
Files returns the
collection of files
in an upload.
Files is a Read Only property.
Example
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
Set FirstFile = objFileUpEE.Files(0)
FirstFile.OverwriteFile = False
FirstFile.DestinationPath = "C:\Uploads\Images\file.gif"
...
Top |
| FileUpCompat |
Syntax
objFileUpEE.FileUpCompat [= Boolean]
Description
FileUpCompat allows you to use FileUpEE with
Classic FileUp
.
You can use FileUpEE to create a 3-tier upload
(client -> Web Server -> file server) without rewriting your existing Classic FileUp script.
A Classic FileUp upload application includes a client-side file submission script and
a server-side script that uses FileUp to process the upload:
In a 3-tier FileUpEE upload, if FileUpCompat is set to True on the Web
server, you can use a Classic FileUp script on the file server:
When you use an existing Classic FileUp script on the file server,
in your Web server script:
- Set
FileUpCompat to True.
- Call
ProcessRequest.
- Set
TargetUrl.
- Call
SendRequest.
FileUpCompat is a Read/Write property.
Example
The following is a Web server script in a 3-tier upload that uses
Classic FileUp on the server:
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.FileUpCompat = True
objFileUpEE.ProcessRequest Request
objFileUpEE.TargetUrl = "http://localhost/fileupeescripts/fs.asp"
objFileUpEE.SendRequest(Response)
Top |
| Form |
Syntax
objFileUpEE.Form
Description
Form returns the collection of elements
(name/value pairs) uploaded from an HTML form, excluding files.
Form is a Read Only property.
The Form collection has three properties:
| Form Properties |
|---|
Count | Returns the number of form elements (excluding files)
in an uploaded HTML form. |
Exists | Returns True if a specified form element exists, False
if it does not. |
Item | Represents a single form element in a Form
collection. Item is the default property
of Form, therefore, Form(2) is equivalent to
Form.Item(2).
Item takes a key
and returns a form element. The key is the form element's name
(the value of its HTML NAME attribute), or number
(Item numbers are 0-based). |
Is the form element a string or a collection?
Use the following methods to determine whether a member of the Form collection
is a string (e.g., a radio button value) or a collection
(e.g., a set of check box values).
- Checking in ASP with VBScript
In ASP, a collection of elements is an object. Therefore,
to determine whether a form element is a string or a collection, use
IsObject to check if the form element's value is an object. For example,
For each item in objFileUpEE.Form
Response.Write "Name: " & item.Name
Response.Write "<br>"
Response.Write "Value: "
If IsObject(item.Value) then
For each subitem in item.Value
Response.Write "<br>"
Response.Write " Name: " & subitem.Name
Response.Write "<br>"
Response.Write " Value: " & subitem.Value
Next
Else
Response.Write item.Value
End if
Response.Write "<br>"
Next
- Checking in ASP.NET with C#
In ASP.NET check if a form element's value is String to determine
wheter the element is a single element or a collection. Example:
ForEach(SaDictionary objElem in fileUp.Form)
{
if(objElem.Value is String)
{
Page.Response.Write("Name:");
Page.Response.Write(objElem.Name);
Page.Response.Write("Value:");
Page.Response.Write(objElem.Value);
}
else
{
Page.Response.Write("Name:");
Page.Response.Write(strName);
Page.Response.Write("Value:");
Page.Response.Write("<br>");
Page.Response.Write("Sub Array:");
foreach(SaDictionary objSubElem in (IEnumerable )objElem.Value)
{
Page.Response.Write("Name:");
Page.Response.Write(objSubElem.Name);
Page.Response.Write("Value:");
Page.Response.Write(objSubElem.Value);
Page.Response.Write("<br>");
}
}
Page.Response.Write("<br>");
}
Top |
| HostPort |
Syntax
objFileUpEE.HostPort [=Port Number]
Description
Specifies the port that FileUpEE will use on the
File Server. The default value of HostPort is 80. Note that
on the Web server, FileUpEE will always use port 80.
HostPort is a Read/Write property.
Top |
| Item |
Syntax
objFileUpEE[.Item](Key)
Description
Item
represents a single file in a file transfer. Item
is the default property of FileUpEE,
so objFileUpEE(2) is equivalent to
objFileUpEE.Item(2).
Item numbers are 0 based.
Item takes a key and returns a
FileEE object.
Example
'--- Save the first file in an upload to a directory
objFileUpEE(0).SaveMethod = saDiskFile
objFileUpEE(0).DestinationFileName = "C:\Uploads\Images\image.jpg"
objFileUpEE(0).OverwriteFile = True
Top |
| JobId |
Syntax
objFileUpEE.JobId [= JobId as String]
Description
In a resumable upload, FileUpEE generates a unique
JobId for each upload (not for each file). If the upload
is suspended, the upload's JobId and information about the incomplete
upload will be stored in an upload status database. You can then call
Resume to resume the upload.
The Resume method takes an upload's JobId
and uses it to get the suspended upload's status from the database. Resume
then continues the upload from the point at which it stopped.
JobId is a Read/Write property.
Example
In a standard 3-tier upload (client -> Web server -> file server), there are three
scripts: the client-side file submission script, the Web server script, and the file server
script. A resumable upload has two additional scripts: a resume-upload script and a
status server script.
If the upload from Web server to file server is suspended, and the
user clicks a Resume link/button, the resume-upload script will be called. When the
Resume method (within the resume-upload script) is called, a request
will be made to the status server script. The response will tell FileUpEE the point at
which the upload was suspended.
The following lines from the Web server script create a link to the resume-upload
script (send.asp). The query string includes the JobId which the
Resume method will need to get the status of the suspended upload.
...
On error resume next
numRetVal = objFileUpEE.SendRequest()
'--- If the upload from Web server to file server
'--- is suspended because of a network error, display
'--- a "Resume upload" link to send.asp.
If err.number <> 0 then
Response.Write "<h2>Upload Failed</h2><br>"
Response.Write objFileUpEE.Error
Response.write "<br><a href=send.asp?JobId=" & objFileUpEE.JobId &_
">Resume upload</a>"
Response.End
End if
...
In the resume-upload script (send.asp), Resume takes the upload's
JobId and makes a request to
the status server which returns the number of bytes received on the file server.
Resume then continues the upload from the point at which it stopped.
...
'--- The Resume method takes the JobId sent from ws.asp
'--- and resumes the upload from the point at which it
'--- stopped.
objFileUpEE.Resume(Request.QueryString("JobID"))
...
Top |
| MaxKBytes |
Syntax
objFileUpEE.MaxKBytes(SATransferStage) [= Upload size limit in Kilobytes as Double]
Description
MaxKBytes sets a file size limit for an
upload. MaxKBytes is a per-file limit, not a limit for a whole multiple-file
upload. For each file in an upload, FileUpEE will stop writing the file to disk at the value
of MaxKBytes. Note that incomplete files will be saved.
In a client to Web server to file server upload, you can set two upload size limits: a
limit for the Web server and a limit for the file server. The parameter
SATransferStage specifies whether the size limit is for the Web server or
file server.
When MaxKBytes is set to zero, there is no size limit for
uploaded files. MaxKBytes is set to zero by default.
To take effect, MaxKBytes(saWebServer) must be set before
ProcessRequest is called on the Web server.
MaxKBytes(saFileServer) must be set before
ProcessRequest is called on the file server.
MaxKBytes is a Read/Write property.
Parameter
MaxKBytes takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Example
The following is from the Web server script in an upload from browser to
Web server to file server:
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.MaxKBytes(saWebServer) = 500000
objFileUpEE.ProcessRequest Request, True, True
...
Top |
| MaxKBytesToCancel |
Syntax
objFileUpEE.MaxKBytesToCancel(SATransferStage) [= File size limit in Kilobytes as Double]
Description
FileUpEE will abort a file upload
when the size of the transfer reaches the value
of MaxKBytesToCancel. No data will be written to the server's hard
disk, the connection will be terminated, and the browser will display a
"Page not found" message.
Setting MaxKBytesToCancel may reduce the threat of a DoS
(Denial of Service) attack on the file server. When an upload size hits
MaxKBytesToCancel, the connection to the server will be terminated,
the ASP page will finish executing, and the ASP thread will be freed.
In a client to Web server to file server upload, you can set one of two upload size
limits: a limit for the Web server or a limit for the file server. The parameter
SATransferStage specifies whether the size limit is for the Web server or
file server.
To take effect, MaxKBytesToCancel(saWebServer) must be set before
ProcessRequest is called on the Web server.
MaxKBytesToCancel(saFileServer) must be set before
ProcessRequest is called on the file server.
MaxKBytesToCancel is a Read/Write property.
Parameter
MaxKBytesToCancel takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Example
The following is from the file server script in an upload from browser to
Web server to file server:
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
'--- Set MaxKBytesToCancel before calling ProcessRequest.
objFileUpEE.MaxKBytesToCancel(saFileServer) = 500000
objFileUpEE.ProcessRequest Request, True, True
...
Top |
| OverwriteFiles |
Syntax
objFileUpEE.OverwriteFiles [= Boolean]
Description
When OverwriteFiles set to True,
an uploaded file will overwrite an existing file with the same name. When
OverwriteFiles is set to False, an uploaded file will not
be saved if a file with the same name exists.
OverwriteFiles is a Read/Write property, and is set to True by
default.
See Also
To set this property for individual files, rather than the whole upload, use
FileEE.OverwriteFile.
Top |
| Page |
Syntax
objFileUpEE.Page [Page]
Description
Use the Page property with
DynamicAdjustScriptTimeout under
ASP.NET.
If DynamicAdjustScriptTimeout is
set to True - either in script or in the registry - you must pass the
ASP.NET Page object to FileUpEE. Pass the Page object to FileUpEE
either,
- In FileUpEE's constructor:
FileUpEe pFileUpEe = new FileUpEe(Page);
OR
- Through the
Page property:
pFileUpEe.Page = Page;
When DynamicAdjustScriptTimeout is set to True,
if you do not pass the Page reference to FileUpEE, the request will
not fail, but DynamicAdjustScriptTimeout will not be enabled.
Top |
| PerConnectionBandwidthLimit |
Syntax
objFileUpEE.PerConnectionBandwidthLimit(SATransferStage)
[= Bandwidth Limit in Kilobytes as Long]
Description
PerConnectionBandwidthLimit limits each download connection
to a specific bandwidth. If this property is set, each
download will not exceed the designated speed.
Example
Set Download = Server.CreateObject("SoftArtisans.FileUpEE")
'--- Set bandwidth limit to 10 KB per connection
Download.PerConnectionBandwidthLimit = 10
'--- Start the download
Download.TransferFile Request, Response, "C:\Images\image.gif"
Top |
| PerServerBandwidthLimit |
Syntax
objFileUpEE.PerServerBandwidthLimit(SATransferStage)
[= Bandwidth Limit in Kilobytes as Long]
Description
When used in a download, PerServerBandwidthLimit
will limit the total server output to a specific bandwidth.
If PerServerBandwidthLimit is set, the total speed of the server's output for
all connections combined will not exceed the designated limit.
Each connection will get a proportion of bandwidth based on the
total bandwidth available, divided by the number of current connections.
Set Download = Server.CreateObject("SoftArtisans.FileUpEE")
'--- Set the server output bandwidth limit to 1000 KB for all connections combined
Download.PerServerBandwidthLimit = 1000
'--- Start the download
Download.TransferFile Request, Response, "C:\Images\image.gif"
Top |
| PreserveMacBinary |
Syntax
objFileUpEE.PreserveMacBinary [= Boolean]
Description
If PreserveMacBinary is set to True, files uploaded from
a Macintosh will be saved in MacBinary format. If this property
is set to False, the data fork will be extracted and saved as the uploaded
file. PreserveMacBinary is set to False by default.
PreserveMacBinary is a Read/Write property.
Example
objFileUpEE.PreserveMacBinary = True
Top |
| ProgressId |
Syntax
objFileUpEE.ProgressId(SATransferStage) [= Long]
Description
ProgressId sets or returns an ID number
for an upload that is being monitored by FileUpEE's
progress indicator.
ProgressId is a Read/Write property.
Parameter
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).
ProgressId takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values for ProgressId |
saClient | 0 | Upload to Web server |
saWebServer | 1 | Upload from Web server |
Example
The following is from the Web server script in a 3-tier upload (client -> Web server ->
file server) application with a progress indicator.
Dim objFileUpEE
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEe")
objFileUpEE.TransferStage = saWebServer
'--- Enable the progress indicator for both stages of the upload.
objFileUpEE.ProgressIndicator(saClient) = True
objFileUpEE.ProgressIndicator(saWebServer) = True
'--- Set the ProgressIds for each stage to the ProgressId values
'--- sent in the QueryString.
objFileUpEE.ProgressId(saClient) = cint(Request.QueryString("progressid"))
objFileUpEE.ProgressId(saWebServer) = cint(Request.QueryString("WSprogressid"))
...
Top |
| ProgressIndicator |
Syntax
objFileUpEE.ProgressIndicator(SATransferStage) [= Boolean]
Description
Set ProgressIndicator to True
to turn on progress logging for the specified upload transfer stage.
ProgressIndicator is set to False by default.
ProgressIndicator is a Read/Write property.
Example
The following is from the Web server script in a 3-tier upload (client -> Web server ->
file server) application with a progress indicator.
Dim objFileUpEE
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEe")
objFileUpEE.TransferStage = saWebServer
'--- Enable the progress indicator for both stages of the upload.
objFileUpEE.ProgressIndicator(saClient) = True
objFileUpEE.ProgressIndicator(saWebServer) = True
'--- Set the ProgressIds for each stage to the ProgressId values
'--- sent in the QueryString.
objFileUpEE.ProgressId(saClient) = cint(Request.QueryString("progressid"))
objFileUpEE.ProgressId(saWebServer) = cint(Request.QueryString("WSprogressid"))
...
Top |
| ReceiveTimeout |
Syntax
objFileUpEE.ReceiveTimeout [= Timeout in Seconds as Long]
Description
ReceiveTimeout sets a time-out value, in seconds,
for receiving a response to a request. If a response takes longer
than this value, the request will be cancelled.
The default value of ReceiveTimeout is 40 seconds.
ReceiveTimeout is a Read/Write property.
Example
objFileUpEE.ReceiveTimeout = 60
Top |
| RequestTimeout |
Syntax
objFileUpEE.RequestTimeout(SATransferStage) [= Timeout in Seconds as Long]
Description
RequestTimeout sets a
time, in seconds, at which a file transfer request will be killed, whether
it is finished or not. The default value of RequestTimeout is 40 seconds.
RequestTimeout is a Read/Write property.
Parameter
RequestTimeout takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Example
objFileUpEE.RequestTimeout(saWebServer) = 60
Top |
| ResolveTimeout |
Syntax
objFileUpEE.ResolveTimeout [= Timeout in Seconds as Long]
Description
ResolveTimeout sets a time-out value, in seconds, to use for name
resolution. Name resolution is the process of obtaining a TCP/IP address from a
host name (such as softartisans.com). If resolution takes longer than the value
of ResolveTimeout, the action is cancelled.
The default value of ResolveTimeout is 40 seconds.
ResolveTimeout is a Read/Write property.
Example
objFileUpEE.ResolveTimeout = 60
Top |
| Resumable |
Syntax
objFileUpEE.Resumable(SATransferStage) [= Boolean]
Description
When Resumable is set to True, FileUpEE
will be able to resume an upload that was suspended because of a network connection
failure, or because the upload size was greater than
MaxKBytesToCancel. Resumable is set to
False by default.
Resumable takes the parameter SATransferStage which specifies
the stage of the upload: client -> Web server or Web server -> file server. FileUpEE
can resume an upload that was suspended between Web server and file server. FileUpEE
does not support resumable uploads from client to Web server. However, in the
Web server script, you must set Resumable to True for both transfer stages.
Set Resumable before calling ProcessRequest.
Resumable is a Read/Write property.
Parameter
Resumable takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Example
The following lines are from the Web server script in a resumable 3-tier upload (client ->
Web server -> file server) application.
Dim objFileUpEE
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
'--- Set the upload's transfer stage to saWebServer.
objFileUpEE.TransferStage = saWebServer
'--- Enable resumable upload on the Web server.
objFileUpEE.Resumable(saWebServer) = True
'--- Enable resumable upload on the file server.
objFileUpEE.Resumable(saFileServer) = True
'--- Set the connection string for the Web server's
'--- upload status database.
objFileUpEE.ResumeConnectionString(saWebServer) = "Provider=" &_
"Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath(Application("vroot") & "FileUpEEWS.mdb") & _
";Persist Security Info=False"
'--- Set the connection string for the file server's
'--- upload status database.
objFileUpEE.ResumeConnectionString(saFileServer) = "Provider=" &_
"Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath(Application("vroot") & "FileUpEEFS.mdb") & _
";Persist Security Info=False"
'--- Pass the Request object to FileUpEE.
objFileUpEE.ProcessRequest Request
....
Top |
| ResumeConnectionString |
Syntax
objFileUpEE.ResumeConnectionString(SATransferStage) [= Connection String]
Description
In a resumable upload, if the upload is
suspended - because of a network connection failure, or because the upload size was
greater than MaxKBytesToCancel - FileUpEE will save information about
the incomplete upload in an upload status database. ResumeConnectionString
sets the connection string for the upload status database.
A resumable 3-tier upload (client -> Web server -> file server) application uses
two status databases, one on the Web server and one on the file server. In the Web server
script, set ResumeConnectionString for both Web server and file server. In
the file server script set ResumeConnectionString for the file server.
Set ResumeConnectionString before calling
ProcessRequest.
ResumeConnectionString is a Read/Write property.
Parameter
ResumeConnectionString takes the parameter SATransferStage which
specifies the stage of the upload: client -> Web server or Web server -> file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Example
The following lines are from the file server script in a resumable 3-tier upload (client ->
Web server -> file server) application.
Dim objFileUpEE
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
'--- Set the upload's transfer stage to saFileServer.
objFileUpEE.TransferStage = saFileServer
'--- Enable resumable upload on the file server.
objFileUpEE.Resumable(saFileServer) = True
'--- Set the connection string for the file server's
'--- upload status database. If the upload to the file
'--- server stops before all the data is transferred,
'--- FileUpEE will enter upload status information in
'--- this database. To resume the upload, FileUpEE
'--- reads the status of the suspended upload from this
'--- database.
objFileUpEE.ResumeConnectionString(saFileServer) = "Provider=" &_
"Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath(Application("vroot") & "FileUpEEFS.mdb") & _
";Persist Security Info=False"
'--- Pass the request from the web server to FileUpEe.
objFileUpEe.ProcessRequest Request, True, True
'--- Send the file server response to the web server.
objFileUpEE.SendResponse Response
Top |
| SaveMethod |
Syntax
objFileUpEE.SaveMethod [= saSaveMethod]
Description
SaveMethod specifies whether uploaded files
will be saved to a file directory or in a database.
SaveMethod is a Read/Write property.
Set SaveMethod to an saSaveMethod by name or number:
| saSaveMethod Values |
|---|
| saDatabase | 0 |
| saDiskFile | 1 (Default value) |
See Also
FileEE.SaveMethod
Example
<% ...
objFileUpEE.SaveMethod = saDatabase
objFileUpEE.DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Uploads\files.mdb;" & _
"Persist Security Info=False"
objFileUpEE.DbTableName = "Images"
dbFileName = objFileUpEE.ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
... %>
Top |
| SendTimeout |
Syntax
objFileUpEE.SendTimeout[= Timeout in Seconds as Long]
Description
SendTimeout sets a time-out value, in seconds, to use for
sending requests. If sending a request takes longer than this value, the
send will be cancelled. The default value of SendTimeout
is 40 seconds.
Example
objFileUpEE.SendTimeout = 60
Top |
| SoapEnvelope |
Syntax
objFileUpEE.SoapEnvelope
Description
When scripting a server-to-server SOAP file
transfer, you can use SoapEnvelope to access the
SoapEnvelope object, which represents the
request's SOAP payload (the XML document that contains a SOAP message).
FileUpEE automatically creates the SOAP envelope and sets the elements
within it. However, you can use the SoapEnvelope object to
customize elements of the SOAP payload, such as namespace and headers.
Example
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request, True, True
Set objSoapEnvelope = objFileUpEE.SoapEnvelope
...
Top |
| StatusUrl |
Syntax
objFileUpEE.StatusUrl [=URL]
Description
In a standard 3-tier upload (client -> Web server ->
file server), there are three scripts: the client-side file submission script, the Web server
script, and the file server script. A resumable upload has two additional scripts:
a resume-upload script (on the Web server) and a status server script (on the file server).
If the upload from Web server to file server is suspended, and the user clicks a Resume
link/button, the resume-upload script will be called. When the Resume
method is called (within the resume-upload script), a request will be made to the status
server script. The response will tell FileUpEE the point at which the upload was suspended.
StatusUrl specifies the URL of the status server script. You can set
StatusUrl in the Web server script, before
calling SendRequest, or in the resume-upload script,
before calling Resume.
Example
The status database and the status script are on the file server. You can set
StatusUrl in the Web server script, before
calling SendRequest, or in the resume-upload script,
before calling Resume.
'--- Set the status URL on the file server. If the
'--- upload is suspended, and the user click's "Resume,"
'--- status.asp will return the status of the suspended
'--- upload. The Resume method will restart the upload
'--- from the point at which it stopped.
objFileUpEE.StatusUrl = "http://localhost/fileupee/Resume/status.asp"
Top |
| TargetUrl |
Syntax
objFileUpEE.TargetUrl [= URL]
Description
Set TargetUrl to the page to which
FileUpEE will submit a server-to-server request. TargetUrl is
a Read/Write property.
Example
When submitting an upload from a Web form to a Web server to a file server, set
TargetUrl to the destination page on the file server. So, if the Web form
submits to Webserver.asp, and the processing page on the file server is fileserver.asp,
set TargetUrl on Webserver.asp to the URL of fileserver.asp.
objFileUpEE.TargetUrl = "http://www.fileserver.com/fileserver.asp"
Top |
| TempStorageLocation |
Syntax
objFileUpEE.TempStorageLocation(SATransferStage) [= Temp Directory]
Description
When an upload reaches the Web server
or the file server, the upload is cached. TempStorageLocation sets the cache
directory on the specified server.
If you do not assign a value to TempStorageLocation, uploads will be cached in
the system's default directory for cached files, which is determined by the system
environment variable TEMP.
To take effect, TempStorageLocation(saWebServer) must be set before
ProcessRequest is called on the Web server.
TempStorageLocation(saFileServer) must be set before
ProcessRequest is called on the file server.
You may include or omit the temp path's ending backslash; both of the following
assignments will work:
objFileUpEE.TempStorageLocation(saWebServer) = "C:\Temp\"
objFileUpEE.TempStorageLocation(saWebServer) = "C:\Temp"
TempStorageLocation is a Read/Write property.
Parameter
TempStorageLocation takes the parameter SATransferStage which
specifies whether to set the directory on the Web server or file server. Note that FileUpEE
will cache files on both the Web server and the file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Note
To change the system's default directory for cached files, reset the TEMP environment
variable, as follows:
- Open the Control Panel.
- Select System.
- Select the Advanced tab.
- Click Environment variables...
- Select TEMP from the System Variables list.
- Click Edit.
- Enter a new Variable Value, and click Ok.
Example
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
'--- Set TempStorageLocation before calling
'--- ProcessRequest.
objFileUpEE.TempStorageLocation(saWebServer) = "c:\upload\temp"
objFileUpEE.ProcessRequest Request
Top |
| TransferStage |
Syntax
objFileUpEE.TransferStage [= SATransferStage]
Description
TransferStage specifies the stage of an
upload, which may be either Web server or file server. Set TransferStage
by name or number:
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
TransferStage is a Read/Write property.
Example
Set a script's TransferStage before calling
ProcessRequest:
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
'--- Set the upload's transfer stage to saWebServer.
objFileUpEE.TransferStage = saWebServer
objFileUpEE.ProcessRequest Request
Top |
| UseChecksum |
Syntax
objFileUpEE.UseChecksum [= Boolean]
Description
UseChecksum allows you to verify the
integrity of data uploaded from Web server to file server. If UseChecksum
is set to True on the Web server, FileUpEE
will generate a file content checksum for the upload and send the checksum with the
upload to the file server. On the file server, use
ValidateChecksums to
verify that the data was not corrupted during transfer.
UseChecksum is a Read/Write property.
See Also
You can generate and validate a content checksum for a single file or for the whole
upload. For information on using per-file checksums, see
FileEE.Checksum,
FileEE.ContentChecksum,
FileEE.UseChecksum, and
FileEE.ValidateChecksum.
Top |
| UseMemory |
Syntax
objFileUpEE.UseMemory(SATransferStage) [= Boolean]
Description
If UseMemory is set to True,
FileUpEE will store data uploaded to the specified server in memory until the data is
saved. If UseMemory is set to False,
data uploaded to the specified server will be cached in a temporary directory until it
is saved. UseMemory is set to False
by default.
The benefits of caching in memory may be:
- Security
No files are written to disk until the upload is saved.
- Performance
Caching files in memory can increase the speed of uploads. However,
before setting UseMemory to True you should consider other factors
affecting the upload, such as, available memory on the file server,
how active the server is, and the size of the upload. If an upload is larger
than 1-5 MB (depending on the system load), caching in memory will probably not
improve performance.
Do not set UseMemory
to True if you expect very large uploads (100 MB or more).
To take effect, UseMemory(saWebServer) must be set before
ProcessRequest is called on the Web server.
UseMemory(saFileServer) must be set before
ProcessRequest is called on the File server.
UseMemory is a Read/Write property.
Parameter
UseMemory takes the parameter SATransferStage which
specifies whether to cache in memory on the Web server or file server. Note that FileUpEE
will cache files on both the Web server and the file server.
| SATransferStage Values |
saWebServer | 1 |
saFileServer | 2 |
Note on UseMemory and the ISAPI Filter
FileUpEE's UseMemory
property allows you to keep uploaded data in memory until it is saved.
FileUpEE's ISAPI filter
reads the whole upload request and writes it to temporary
files before the request is processed by the ASP page on the server.
If you set UseMemory in the ASP page, the property will have no effect
because the page is processed after the ISAPI filter writes the temp files.
To set UseMemory when using the ISAPI filter, include the property in the
request query string, as in the following lines from an upload request script:
<SCRIPT Language="JavaScript">
function startupload() {
document.theForm.action="formresp.upl?usememory=true";
}
</script>
...
<FORM onSubmit="startupload();" name="theForm" ACTION="formresp.upl"
ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST">
...
Example
objFileUpEE.UseMemory(saWebServer) = True
Top |
| FileUpEE Methods |
| Add |
Syntax
objFileUpEE.Add(FileBuffer, [Name], [ContentId])
Description
Adds a file to the
FileCollection. The source of this file
is a byte array.
Top |
| AddDbDownloadFile |
Syntax
objFileEE = objFileUpEE.AddDbDownloadFile(ClientFileName,
[Name],[WebServerDownload as Boolean])
Description
AddDbDownloadFile adds a file from a
database to the collection of files to download. AddDbDownloadFile
takes the download destination file name and returns a FileEE
object.
To download a file from a database, you must set the file's table name, primary key column,
primary key value, file column name, and the database connection string.
Parameters
ClientFileName |
The destination name of the downloaded file. |
|
Name |
Optional. The value of name may be used to reference the
file in script, for example:
objFileUpEE("file1").ContentType = "text/plain"
|
Default value: "" |
WebServerDownload |
Optional. To script a download from a file server to a Web server to a client,
set WebServerDownload to False. To script a download from a Web
server to a client, set WebServerDownload to True. |
Default value: False |
See Also
FileUpEE.DbTableName,
FileUpEE.DbPrimaryKey,
FileUpEE.DbPrimaryKeyValue,
FileUpEE.DbFileColumnName,
FileUpEE.DbConnection,
FileEE.DbTableName,
FileEE.DbPrimaryKey,
FileEE.DbPrimaryKeyValue,
FileEE.DbFileColumnName, and
FileEE.DbConnection.
Example
The following Web server script gets the download destination directory
from the form field "Client."
Dim objFileUpEE
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request
objFileUpEE.AddDbDownloadFile fileUp.Form("Client")
objFileUpEE(0).DbTableName = "Files"
objFileUpEE(0).DbPrimaryKey = "FileId"
objFileUpEE(0).DbPrimaryKeyValue = "260"
objFileUpEE(0).DbFileColumnName = "File"
objFileUpEE(0).DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0; _
Data Source=C:\FilesDB\files.mdb; Persist Security Info=False"
objFileUpEE.TargetUrl = "http://localhost/fileupee/dbdownload/fsDownDb.asp"
objFileUpEE.SendRequest(Response)
Top |
| AddDownloadFile |
Syntax
objFileEE = objFileUpEE.AddDownloadFile(DownloadPath, ClientPath, [Name], [WebServerDownload as Boolean])
Description
AddDownloadFile adds a file to the
collection of files to download.
Parameters
DownloadPath |
The path and name of the file to download. |
|
ClientPath |
The destination path and name of the downloaded file. |
|
Name |
Optional. The value of name may be used to reference the
file in script, for example:
objFileUpEE("file1").ContentType = "text/plain"
|
Default value: "" |
WebServerDownload |
Optional. To script a download from a file server to a Web server
to a client, set WebServerDownload to False. To script
a download from a Web server to a client, set WebServerDownload
to True. |
Default value: False |
Example
The following Web server script gets the download's source and destination directories
from the form fields "Download" and "Client."
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request
objFileUpEE.AddDownloadFile objFileUpEE.Form("Download"), _
objFileUpEE.Form("Client")
objFileUpEE.TargetUrl = "http://localhost/fileupee/download/fsDown.asp"
enumRetVal = objFileUpEE.SendRequest(Response)
Top |
| AddFile |
Syntax
objFileUpEE.AddFile(FileName, [Name], [ContentId])
Description
Use AddFile to add a file from the file
system to the collection of files to upload.
Parameters
FileName |
File path and name |
|
Name |
Optional. Equivalent to FileEE.Name.
The name assigned can be used as the file's key. For example,
objFileUpEE.AddFile "C:\first.xls","AddedFile",1234
objFileUpEE("AddedFile").OverwriteFile = False
objFileUpEE("AddedFile").DestinationPath = "C:\Uploads\Images\file.gif"
... |
|
ContentId |
Optional. Equivalent to FileEE.ContentId.
FileUpEE will automatically generate a unique content-id
for each file uploaded, unless a content-id is assigned in script, as in the
following example:
objFileUpEE.AddFile "C:\first.xls","AddedFile",1234
|
Default value: "" |
Example
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request
objFileUpEE.AddFile "C:\first.xls","AddedFile",1234
objFileUpEE("AddedFile").OverwriteFile = False
objFileUpEE("AddedFile").DestinationPath = "C:\Uploads\Images\file.gif"
...
Top |
| AddFileEE |
Syntax
objFileUpEE.AddFileEE (FileEE Instance)
Description
AddFileEE adds an instance of the
FileEE object to the file collection.
Top |
| ProcessRequest |
Syntax
saResult = objFileUpEE.ProcessRequest(Request, [SoapRequest],
[AutoProcess])
Description
ProcessRequest passes the
Request object (as an IStream) to FileUpEE. The collection of transferred
files is not available until after ProcessRequest is called.
Parameters
Request |
The ASP Request object. |
|
SoapRequest |
When set to True, FileUpEE will process the file transfer
as a SOAP transfer. Set SoapRequest to True when
transferring files from server to server, for example, when
transferring files from your Web server to a file server.
When set to False, FileUpEE will process the file transfer as
a form-based file upload. Set SoapRequest to
False when uploading files from client to server, that is,
when processing uploads from an HTML form. |
Default value: False |
AutoProcess |
If AutoProcess
is set to True, FileUpEE
will process the Request according to the SOAP payload (the XML
document tranferred with a SOAP request), and processing
instructions (such as a Save statement) are not required in the script
that contains the ProcessRequest statement.
When AutoProcess is set to True, the SOAP payload
must contain all necessary information to process the Request. For
example, when uploading from a Web server to a file server,
if AutoProcess is set to True in the file server script, the
Web server script must contain all file server instructions.
The instructions will be executed automatically on the file server.
If AutoProcess is set to False, FileUpEE
will process the Request according to your script. In this case,
include all processing instructions (such as database information)
in your script.
|
Default value: False |
Return Value
ProcessRequest returns an saResult:
| saResult Values |
|---|
saAllProcessed | 0 | All files were processed
without error. |
Note
saResult values specify whether or not files
were processed correctly, not whether they were saved.
If, for example, an uploaded file is not saved because
FileEE.OverwriteFile
is disabled, the file was processed without error. |
saSomeProcessed | 1 | Errors occurred when
processing one or more files. Some
files were processed without error. |
saNoneProcessed | 2 | Errors occurred when
processing all files. |
saNetworkError | 3 | A network error
stopped the upload before it was complete. |
saMaxUpload | 4 | The upload size
was greater than
MaxKBytesToCancel.
The upload stopped at that value. |
saFileNotFound | 5 | |
saSendError | 6 | Generic server error. |
saGeneralError | 7 | |
Examples
To process an upload from an HTML form, use:
objFileUpEE.ProcessRequest Request
To process a SOAP file transfer from a Web server to a file server,
according to the SOAP payload, use:
objFileUpEE.ProcessRequest Request, True, True
Top |
| Resume |
Syntax
objFileUpEE.Resume(JobId)
Description
Resumes an upload that was suspended because of a
network connection failure, or because the upload size was greater than
MaxKBytesToCancel. Resume
works at the request level, not the file level; if there are several files in an
upload, you cannot call Resume for a specific file.
Parameter
Resume takes an upload's
JobId and uses it to get the suspended upload's status from
an upload status database. Resume then continues the upload from the point
at which it stopped.
Set StatusUrl before calling Resume.
Return Value
Resume returns an saResult:
| saResult Values |
|---|
saAllProcessed | 0 | All files were processed
without error. |
Note
saResult values specify whether or not files
were processed correctly, not whether they were saved.
If, for example, an uploaded file is not saved because
FileEE.OverwriteFile
is disabled, the file was processed without error. |
saSomeProcessed | 1 | Errors occurred when
processing one or more files. Some
files were processed without error. |
saNoneProcessed | 2 | Errors occurred when
processing all files. |
saNetworkError | 3 | A network error
stopped the upload before it was complete. |
saMaxUpload | 4 | The upload size
was greater than
MaxKBytesToCancel.
The upload stopped at that value. |
saFileNotFound | 5 | |
saSendError | 6 | Generic server error. |
saGeneralError | 7 | |
Example
In a standard 3-tier upload (client -> Web server -> file server), there are three
scripts: the client-side file submission script, the Web server script, and the file server
script. A resumable upload has two additional scripts: a resume-upload script and a
status server script.
If the upload from Web server to file server is suspended, and the
user clicks a Resume link/button, the resume-upload script will be called. When the
Resume method (within the resume-upload script) is called, a request
will be made to the status server script. The response will tell FileUpEE the point at
which the upload was suspended.
The following lines from the Web server script create a link to the resume-upload
script (send.asp). The query string includes the JobId which the
Resume method will need to get the status of the suspended upload.
...
On error resume next
numRetVal = objFileUpEE.SendRequest()
'--- If the upload from Web server to file server
'--- is suspended because of a network error, display
'--- a "Resume upload" link to send.asp.
If err.number <> 0 then
Response.Write "<h2>Upload Failed</h2><br>"
Response.Write objFileUpEE.Error
Response.write "<br><a href=send.asp?JobId=" & objFileUpEE.JobId &_
">Resume upload</a>"
Response.End
End if
...
In the resume-upload script (send.asp), Resume takes the upload's
JobId and makes a request to
the status server which returns the number of bytes received on the file server.
Resume then continues the upload from the point at which it stopped.
...
'--- The Resume method takes the JobId sent from ws.asp
'--- and resumes the upload from the point at which it
'--- stopped.
objFileUpEE.Resume(Request.QueryString("JobID"))
...
Top |
| ReturnStatus |
Syntax
objFileUpEE.ReturnStatus(Request, Response)
Description
In a resumable upload, FileUpEE generates a unique
JobId for each upload (not for each file). If the upload is suspended,
the upload's JobId and information about the incomplete upload will be stored
in an upload status database. You can then call Resume to resume the
upload.
When Resume is called, FileUpEE makes a request to the
StatusUrl to get status of the suspended upload.
In the StatusUrl page, after getting the data from the upload
status database, call ReturnStatus which will send a response
to the Resume method. The response will tell FileUpEE the point
at which the upload was suspended.
Example
In a standard 3-tier upload (client -> Web server -> file server), there are three
scripts: the client-side file submission script, the Web server script, and the file server
script. A resumable upload has two additional scripts: a resume-upload script and a
status server script.
If the upload from Web server to file server is suspended, and the
user clicks a Resume link/button, the resume-upload script will be called. When the
Resume method (within the resume-upload script) is called, a request
will be made to the StatusUrl page. The response will tell FileUpEE the point at
which the upload was suspended.
The following lines are from the StatusUrl page of a resumable upload
application.
'--- Set the connection string for the file server's
'--- upload status database. If the upload to the file
'--- server stops before all the data is transferred,
'--- FileUpEE will enter upload status information in
'--- this database. To resume the upload, FileUpEE
'--- reads the status of the suspended upload from this
'--- database.
objFileUpEE.ResumeConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath(Application("vroot") & _
"FileUpEEFS.mdb") & ";Persist Security Info=False"
'--- Return the suspended upload's status to the Resume call.
objFileUpEE.ReturnStatus Request, Response
Top |
| SendRequest |
Syntax
objFileUpEE.SendRequest([Response])
Description
SendRequest
sends the HTTP file transfer request to the server, and returns an
saResult:
| saResult Values |
|---|
saAllProcessed | 0 | All files were processed
without error. |
Note
saResult values specify whether or not files
were processed correctly, not whether they were saved.
If, for example, an uploaded file is not saved because
FileEE.OverwriteFile
is disabled, the file was processed without error. |
saSomeProcessed | 1 | Errors occurred when
processing one or more files. Some
files were processed without error. |
saNoneProcessed | 2 | Errors occurred when
processing all files. |
saNetworkError | 3 | A network error
stopped the upload before it was complete. |
saMaxUpload | 4 | The upload size
was greater than
MaxKBytesToCancel.
The upload stopped at that value. |
saSendError | 5 | Generic server error. |
Parameter
Response |
Optional. When downloading files from a file server to a Web server
to a browser, pass the file server Response to SendRequest.
That is, send the file server Response from the Web server to the client.
When SendRequest is used to send a file download request in ASP,
data is streamed from file server to client through the Web server without
being cached entirely on the Web server. In ASP.NET, by default, the data will be
cached on the Web server as a temporary file.
|
Upload Example
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request
...
objFileUpEE(0).DestinationPath = "C:\temp\" & objFileUpEE(0).ClientFileName
...
objFileUpEE.TargetUrl = "http://localhost/fileupeescripts/fs.asp"
...
objFileUpEE.SendRequest()
Download Example
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
...
objFileUpEE.AddDownloadFile "c:\reports\april.xls", "c:\downloads\april.xls"
objFileUpEE.TargetUrl = "http://localhost/fileupeedownload/fsDown.asp"
objFileUpEE.SendRequest(Response)
...
Top |
| SendResponse |
Syntax
objFileUpEE.SendResponse Response
Description
SendResponse takes the ASP response
object (as an IStream) and sends the response from the file server to the Web server.
Example
'--- The following is a file server script for an upload from browser to
'--- Web server to file server. Note that AutoProcess is set to
'--- True, so FileUpEE will process the Request according to the SOAP
'--- payload, and processing instructions (such as a Save statement) are not
'--- required in script.
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request, True, True
objFileUpEE.SendResponse Response
Response.End
Top |
| TransferFile |
Syntax
objFileUpEE.TransferFile(Request,Response,FileName,[URL])
Description
TransferFile downloads a file from file server to Web server to client, or
from Web server to client.
TransferFile simplifies the download process under ASP; it is not available
under ASP.NET. To download a file, we recommend using
AddDownloadFile or
AddDbDownloadFile with
the FileEE object's WriteToResponse
method.
In a Web server -> client download, do not set
the URL parameter. Set the content-type response header to the file's
ContentType in the Web server page.
In a file server -> Web server -> client download, in the
file server page, set the URL parameter to the Web server page
that will download the file. Set the content-type response header to the file's
ContentType in the file server page.
Parameters
Request | The ASP Request object. |
Response | The ASP Response object. |
FileName | The path and name of the file to download. |
[URL] | Optional. In a file server -> Web server -> client download, in the
file server page, set the URL parameter to the Web server page
that will download the file. |
Example
'--- From the file server page in a 3-tier download.
objFileUpEE.TransferFile Request, Response, "C:\Images\image.gif",_
"http://WebServer/download.asp"
Top |
| ValidateChecksums |
Syntax
objFileUpEE.ValidateChecksums
Description
Use ValidateChecksums to verify the
integrity of data transferred from Web server to file server.
If UseChecksum is set to True on
the Web server, FileUpEE will generate a file content checksum for the upload and send
the checksum with the upload. On the file server, use ValidateChecksums to
verify that the data was not corrupted during transfer.
If the upload content checksum received from the Web server and the checksum generated on
the file server are identical, ValidateChecksums returns True. If the checksums
are not identical, the upload was corrupted during transfer, and ValidateChecksums
returns False.
Example
The following is from the file server script in a client -> Web server -> file server
upload.
bRetVal = objFileUpEE.ValidateChecksums()
If bRetVal = False then
objFileUpEE.Error = "Checksum validation failed"
End if
See Also
You can generate and validate a content checksum for a single file or for the whole
upload. For information on using per-file checksums, see
FileEE.Checksum,
FileEE.ContentChecksum,
FileEE.UseChecksum, and
FileEE.ValidateChecksum.
Top |
Copyright © 2003, SoftArtisans, Inc.
|