FileEe Properties |
Body |
Syntax
objFileEe.Body
Description
Body contains the contents of the file represented by the specified
instance of FileEe .
Body is a Read Only property.
Example
In ASP.NET:
[C#]
Response.Write(objFileUpEE[1].Body);
[VB.NET]
Response.Write(objFileUpEE(1).Body)
In ASP:
[VBScript]
Response.Write objFileUpEE(1).Body
Top
|
Checksum |
Syntax
objFileEe.Checksum
Description
FileUpEE allows you to verify the integrity of data uploaded from web server to file
server. If FileEe.UseChecksum is
enabled on the web server, FileUpEE will generate a file content checksum for the
specified file and send the file's checksum with the upload to the file server.
On the file server, use FileEe.ValidateChecksum
to verify that the data was not corrupted during transfer.
Checksum contains the file content checksum that was generated on the
file server, after the upload was received. Checksum is a Read
Only property.
See Also
Top
|
ChunkSize |
Syntax
objFileEe.ChunkSize [= Size in KiloBytes]
Description
When transferring a file to or from a database, FileUpEE does not transfer the whole
file at once; a file is uploaded to or downloaded from a database in data chunks.
ChunkSize sets the size in kilobytes of a data chunk. Setting ChunkSize
allows you to fine tune performance based on your network and database.
ChunkSize is a Read/Write property.
Top
|
ClientFileName |
Syntax
objFileEe.ClientFileName [= File Name]
Description
ClientFileName returns the original name of the uploaded file, without
a path.
ClientFileName is a Read Only property.
Example
In ASP.NET:
[C#]
...
objFileUpEE[1].SaveMethod = saSaveMethod.saDatabase;
...
String dbFileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].DbSchema.Add("File Name", dbFileName);
...
[VB.NET]
...
objFileUpEE(1).SaveMethod = saSaveMethod.saDatabase
...
Dim dbFileName As String = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add("File Name", dbFileName)
...
In ASP:
[VBScript]
...
objFileUpEE(1).SaveMethod = saDatabase
...
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
...
Top |
ClientPath |
Syntax
objFileEe.ClientPath [= Path and File Name]
Description
In an upload, ClientPath returns the original path and file name of
the uploaded file. In a download, ClientPath sets a name to display
in the browser's "Open or Save" dialog.
ClientPath is a Read/Write property.
Example
In ASP.NET:
[C#]
...
foreach(FileEe file in objFileUpEE.Files)
{
Response.Write("Original file name and location: " + file.ClientPath);
...
}
[VB.NET]
...
For Each file As FileEe In objFileUpEE.Files
Response.Write("Original file name and location: " & file.ClientPath)
...
Next
In ASP:
[VBScript]
...
For each file in objFileUpEE.Files
Response.Write "Original file name and location: " & file.ClientPath
...
next
Top |
ContentDisposition |
Syntax
objFileEe.ContentDisposition [= MIME Content-Disposition as String]
Description
ContentDisposition specifies the file's MIME content-disposition. For
example, when uploading a file from a web form, the content-disposition value is
"form-data."
Top |
ContentId |
Syntax
objFileUpEE(Key).ContentId [= String]
Description
ContentId specifies a unique content-id for each file in a file transfer.
FileUpEE automatically generates a ContentId . Alternatively, you may
set ContentId in script.
ContentId is a Read/Write property.
See Also
Example
In ASP.NET:
[C#]
...
objFileUpEE[1].SaveMethod = saSaveMethod.saDatabase;
objFileUpEE[1].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[1].DbTableName = "Images";
String dbFileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].DbSchema.Add("File Name", dbFileName);
objFileUpEE[1].DbSchema.Add("ContentId", objFileUpEE[1].ContentId);
...
[VB.NET]
...
objFileUpEE(1).SaveMethod = saSaveMethod.saDatabase
objFileUpEE(1).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(1).DbTableName = "Images"
Dim dbFileName As String = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add("File Name", dbFileName)
objFileUpEE(1).DbSchema.Add("ContentId", objFileUpEE(1).ContentId)
...
In ASP:
[VBScript]
...
objFileUpEE(1).SaveMethod = saDatabase
objFileUpEE(1).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(1).DbTableName = "Images"
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
objFileUpEE(1).DbSchema.Add "ContentId", objFileUpEE(1).ContentId
...
Top |
ContentType |
Syntax
objFileEE.ContentType[= MIME Content-Type as String]
Description
ContentType specifies the transferred file's MIME content type (e.g.,
text/plain, application/msword, image/jpeg, application/pdf).
ContentType is a Read/Write property.
In ASP.NET:
[C#]
FileUpEE objFileUpEE = new FileUpEE();
objFileUpEE.TransferStage = saTransferStage.saWebServer;
objFileUpEE.ProcessRequest(Request);
//--- Set a file to download.
FileEe File = objFileUpEE.AddDownloadFile(objFileUpEE.Form["ServerFilePath"],
objFileUpEE.Form["ClientFilePath"], "file", true);
//--- To let the browser know how to handle a download, set the
//--- content-type response header to the file's content type before
//--- downloading to the browser.
Response.ContentType = File.ContentType;
//--- Download the file.
File.WriteToResponse(Response);
[VB.NET]
Dim objFileUpEE As New FileUpEE()
objFileUpEE.TransferStage = saTransferStage.saWebServer
objFileUpEE.ProcessRequest(Request)
'--- Set a file to download.
Dim File As FileEe = objFileUpEE.AddDownloadFile(objFileUpEE.Form("ServerFilePath"), _
objFileUpEE.Form("ClientFilePath"), "file", True)
'--- To let the browser know how to handle a download, set the
'--- content-type response header to the file's content type before
'--- downloading to the browser.
Response.ContentType = File.ContentType
'--- Download the file.
File.WriteToResponse(Response)
In ASP:
[VBScript]
Dim objFileUpEE
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.TransferStage = saWebServer
objFileUpEE.ProcessRequest Request
'--- Set a file to download.
Dim File
Set File = objFileUpEE.AddDownloadFile(objFileUpEE.Form("ServerFilePath"), _
objFileUpEE.Form("ClientFilePath"), "file", True)
'--- To let the browser know how to handle a download, set the
'--- content-type response header to the file's content type before
'--- downloading to the browser.
Response.ContentType = File.ContentType
'--- Download the file.
File.WriteToResponse Response
Top |
CreateUniqueFileName |
Syntax
objFileEe.CreateUniqueFileName(Prefix, MaxFiles, Separator) [=
Boolean]
Description
By default, if you upload a file and a file with the same name exists in the destination
directory, the uploaded file will overwrite the existing file. If
FileEe.OverwriteFile is set to false , the uploaded
file will not be saved if a file with the same name exists in the destination directory.
When OverwriteFiles is false , if you set CreateUniqueFileName
to true , FileUpEE will append an underscore and a number to the name of
the uploaded file, if a file with the same name exists in the destination directory.
Parameters
Prefix |
Optional. Specifies whether the separator and number are appended before or after
the file name. If Prefix is false they will be appended after
the file name (for example, filename_4.ext). If Prefix is true
they will be appended before the file name (for example, 4_filename.ext).
Default value: false |
MaxFiles |
Optional. Specifies the highest number that FileUpEE will append to a file name.
The first number FileUpEE appends is 0. So the maximum number of unique names FileUpEE
will create is MaxFiles + 1.
Default value: 999 . |
Separator |
Optional. Specifies the the character the FileUpEE will use to separate the file
name and the number appended to it.
Default value: "_" |
Example
The directory C:\temp contains the file report.doc. The FileUpEE code contains:
In ASP.NET:
[C#]
oFile.set_CreateUniqueFileName(false, 3, "&", true);
oFile.OverwriteFile = false;
oFile.SaveAs(@"C:\temp\report.doc");
[VB.NET]
oFile.CreateUniqueFileName(False, 3, "&") = True
oFile.OverwriteFile = False
oFile.SaveAs("C:\temp\report.doc")
In ASP:
[VBScript]
oFile.CreateUniqueFileName(false,3,"&") = true
oFile.OverwriteFile = false
oFile.SaveAs "C:\temp\report.doc"
If you upload four files named report.doc to C:\temp, the directory will contain:
report.doc, report&0.doc, report&1.doc, report&2.doc, and report&3.doc.
Top
|
DbConnection |
Syntax
objFileUpEE(Key).DbConnection [= Connection String]
Description
Use DbConnection to set the database connection string when transferring
a file to or from a database.
DbConnection is a Read/Write property.
See Also
Per-upload database properties:
FileUpEE.DbConnection ,
FileUpEE.DbPrimaryKey ,
FileUpEE.DbPrimaryKeyValue ,
FileUpEE.DbSqlCommand ,
FileUpEE.DbTableName , and
FileUpEE.SaveMethod .
Per-file database properties: FileEe.DbFileColumnName ,
FileEe.DbPrimaryKey ,
FileEe.DbPrimaryKeyValue , FileEe.DbSqlCommand ,
FileEe.DbTableName , FileEe.SaveAsBlob ,
FileEe.SaveMethod , and
FileEe.DbSchema .
Example
In ASP.NET:
[C#]
objFileUpEE[1].DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=C:\Uploads\Images.mdb;" +
"Persist Security Info=False";
[VB.NET]
objFileUpEE(1).DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Uploads\Images.mdb;" & _
"Persist Security Info=False"
In ASP:
[VBScript]
objFileUpEE(1).DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Uploads\Images.mdb;" & _
"Persist Security Info=False"
Top |
DbFileColumnName |
Syntax
objFileEE.DbFileColumnName [= File Column Name as String]
Description
When transferring a file to or from a database, set DbFileColumnName
to the name of the table column that contains the file.
DbFileColumnName is a Read/Write property.
See Also
Per-upload database properties: FileUpEE.DbConnection ,
FileUpEE.DbPrimaryKey ,
FileUpEE.DbPrimaryKeyValue , FileUpEE.DbSqlCommand ,
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
In ASP.NET:
[C#]
objFileUpEE[1].SaveMethod = saSaveMethod.saDatabase;
objFileUpEE[1].DbTableName = "Files";
objFileUpEE[1].DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=[PATH]\FileUpEE\files.mdb;" +
"Persist Security Info=False";
dbFileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].DbSchema.Add("FileName", dbFileName);
objFileUpEE[1].DbSchema.Add("ContentId", objFileUpEE[1].ContentId);
objFileUpEE[1].DbFileColumnName = "File";
...
[VB.NET]
objFileUpEE(1).SaveMethod = saSaveMethod.saDatabase
objFileUpEE(1).DbTableName = "Files"
objFileUpEE(1).DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=[PATH]\FileUpEE\files.mdb;" & _
"Persist Security Info=False"
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add("FileName", dbFileName)
objFileUpEE(1).DbSchema.Add("ContentId", objFileUpEE(1).ContentId)
objFileUpEE(1).DbFileColumnName = "File"
...
In ASP:
[VBScript]
objFileUpEE(1).SaveMethod = saDatabase
objFileUpEE(1).DbTableName = "Files"
objFileUpEE(1).DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=[PATH]\FileUpEE\files.mdb;" & _
"Persist Security Info=False"
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add "FileName", dbFileName
objFileUpEE(1).DbSchema.Add "ContentId", objFileUpEE(1).ContentId
objFileUpEE(1).DbFileColumnName = "File"
...
Top |
DbIdentityColumnName |
Syntax
objFileEE.DbIdentityColumnName = [= Identity Column Name]
Description
When uploading to a database, if DbIdentityColumnName is set, FileUpEE
will return the identity value for the new row. The row identity value will be in
the DbSchema collection under the name of the identity column
specified by DbIdentityColumnName . For example, if a file's identity
column is set to "FileId," after SendRequest
returns, the file's DbSchema("FileId") collection member will hold the identity
value for that database row.
Example
In ASP.NET:
[C#]
objFileUpEE[1].DbIdentityColumnName = "FileId";
[VB.NET]
objFileUpEE(1).DbIdentityColumnName = "FileId"
In ASP:
objFileUpEE(1).DbIdentityColumnName = "FileId"
Top |
DbPrimaryKey |
Syntax
objFileUpEE(Key).DbPrimaryKey [= Primary Key Column Name]
Description
Sets or returns a database table's primary key column name.
When uploading a file 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.DbPrimaryKey ,
FileUpEE.DbPrimaryKeyValue , FileUpEE.DbSqlCommand ,
FileUpEE.DbTableName , and
FileUpEE.SaveMethod .
Per-file database properties: FileEe.DbConnection , FileEe.DbFileColumnName , FileEe.DbPrimaryKeyValue ,
FileEe.DbSqlCommand , FileEe.DbTableName ,
FileEe.SaveAsBlob , FileEe.SaveMethod ,
and FileEe.DbSchema .
Example
In ASP.NET:
[C#]
objFileUpEE[2].DbTableName = "Files";
objFileUpEE[2].DbSqlCommand = "Select * from Files where FileId = 184";
objFileUpEE[2].DbPrimaryKey = "FileId";
objFileUpEE[2].DbPrimaryKeyValue = "6325";
...
[VB.NET]
objFileUpEE(2).DbTableName = "Files"
objFileUpEE(2).DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE(2).DbPrimaryKey = "FileId"
objFileUpEE(2).DbPrimaryKeyValue = "6325"
...
In ASP:
[VBScript]
objFileUpEE(2).DbTableName = "Files"
objFileUpEE(2).DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE(2).DbPrimaryKey = "FileId"
objFileUpEE(2).DbPrimaryKeyValue = "6325"
...
Top |
DbPrimaryKeyValue |
Syntax
objFileUpEE(Key).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.DbPrimaryKeyValue , FileUpEE.DbSqlCommand ,
FileUpEE.DbTableName , and
FileUpEE.SaveMethod .
Per-file database properties: FileEe.DbConnection , FileEe.DbFileColumnName , FileEe.DbPrimaryKey ,
FileEe.DbSqlCommand , FileEe.DbTableName ,
FileEe.SaveAsBlob , FileEe.SaveMethod ,
and FileEe.DbSchema .
Example
In ASP.NET:
[C#]
objFileUpEE[1].DbTableName = "Files";
objFileUpEE[1].DbSqlCommand = "Select * from Files where FileId = 184";
objFileUpEE[1].DbPrimaryKey = "FileId";
objFileUpEE[1].DbPrimaryKeyValue = "6954";
...
[VB.NET]
objFileUpEE(1).DbTableName = "Files"
objFileUpEE(1).DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE(1).DbPrimaryKey = "FileId"
objFileUpEE(1).DbPrimaryKeyValue = "6954"
...
In ASP:
[VBScript]
objFileUpEE(1).DbTableName = "Files"
objFileUpEE(1).DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE(1).DbPrimaryKey = "FileId"
objFileUpEE(1).DbPrimaryKeyValue = "6954"
...
Top |
DbSchema |
Syntax
objFileEE.DbSchema.Add Column Name, Value
Description
DbSchema is a collection of name-value pairs representing the column
names and values of a database row. Use DbSchema to add or update a
database field.
DbSchema is a Read Only property.
See Also
Per-upload database properties: FileUpEE.DbConnection ,
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 ,
and FileEe.SaveMethod .
Example
In ASP.NET:
[C#]
objFileUpEE[1].SaveMethod = saSaveMethod.saDatabase;
objFileUpEE[1].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[1].DbTableName = "Images";
String dbFileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].DbSchema.Add("File Name", dbFileName);
objFileUpEE[1].DbSchema.Add("ContentId", objFileUpEE[1].ContentId);
...
[VB.NET]
objFileUpEE(1).SaveMethod = saSaveMethod.saDatabase
objFileUpEE(1).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(1).DbTableName = "Images"
Dim dbFileName As String = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add("File Name", dbFileName)
objFileUpEE(1).DbSchema.Add("ContentId", objFileUpEE(1).ContentId)
...
In ASP:
[VBScript]
objFileUpEE(1).SaveMethod = saDatabase
objFileUpEE(1).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(1).DbTableName = "Images"
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
objFileUpEE(1).DbSchema.Add "ContentId", objFileUpEE(1).ContentId
...
Top |
DbSqlCommand |
Syntax
objFileEE.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.DbSqlCommand ,
FileUpEE.DbTableName and
FileUpEE.SaveMethod .
Per-file database properties: FileEe.DbConnection , FileEe.DbFileColumnName , FileEe.DbPrimaryKey ,
FileEe.DbPrimaryKeyValue , FileEe.DbTableName ,
FileEe.SaveAsBlob , FileEe.SaveMethod ,
and FileEe.DbSchema .
Example
In ASP.NET:
[C#]
objFileUpEE[1].DbTableName = "Files";
objFileUpEE[1].DbSqlCommand = "Select * from Files where FileId = 184";
objFileUpEE[1].DbPrimaryKey = "FileName";
objFileUpEE[1].DbPrimaryKeyValue = "file.txt";
...
[VB.NET]
objFileUpEE(1).DbTableName = "Files"
objFileUpEE(1).DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE(1).DbPrimaryKey = "FileName"
objFileUpEE(1).DbPrimaryKeyValue = "file.txt"
...
In ASP:
[VBScript]
objFileUpEE(1).DbTableName = "Files"
objFileUpEE(1).DbSqlCommand = "Select * from Files where FileId = 184"
objFileUpEE(1).DbPrimaryKey = "FileName"
objFileUpEE(1).DbPrimaryKeyValue = "file.txt"
...
Top |
DbTableName |
Syntax
objFileUpEE(Key).DbTableName [= Database Table Name]
Description
When uploading a file 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.
DbTableName is a Read/Write property.
See Also
Per-upload database properties: FileUpEE.DbConnection ,
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.SaveAsBlob , FileEe.SaveMethod ,
and FileEe.DbSchema .
Example
In ASP.NET:
[C#]
objFileUpEE[1].SaveMethod = saSaveMethod.saDatabase;
objFileUpEE[1].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[1].DbTableName = "Images";
String dbFileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].DbSchema.Add("File Name", dbFileName);
objFileUpEE[1].DbSchema.Add("ContentId", objFileUpEE[1].ContentId);
...
[VB.NET]
objFileUpEE(1).SaveMethod = saSaveMethod.saDatabase
objFileUpEE(1).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(1).DbTableName = "Images"
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
objFileUpEE(1).DbSchema.Add "ContentId", objFileUpEE(1).ContentId
...
In ASP:
[VBScript]
objFileUpEE(1).SaveMethod = saDatabase
objFileUpEE(1).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(1).DbTableName = "Images"
dbFileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
objFileUpEE(1).DbSchema.Add "ContentId", objFileUpEE(1).ContentId
...
Top |
Description |
Syntax
objFileEe.Description [= String]
Description
Use Description to send any meta-data with the file transfer request.
Description is a Read/Write property.
Example
In ASP.NET:
[C#]
FileUpEE oFileUpEE = new FileUpEE();
oFileUpEE.TransferStage = saTransferStage.saWebServer;
oFileUpEE.DestinationDirectory = Server.MapPath(@"/FileUpEE/samples/temp");
FileEe oFile = oFileUpEE.Files("myFile");
oFile.Description = "Uploaded file";
oFile.Save();
...
[VB.NET]
Dim oFileUpEE As New FileUpEE()
oFileUpEE.TransferStage = saTransferStage.saWebServer
oFileUpEE.DestinationDirectory = Server.MapPath("/FileUpEE/samples/temp")
Dim oFile As FileEe = oFileUpEE.Files("myFile")
oFile.Description = "Uploaded file"
oFile.Save()
...
In ASP:
[VBScript]
Set oFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
oFileUpEE.TransferStage = saWebServer
oFileUpEE.DestinationDirectory = Server.MapPath("/FileUpEE/samples/temp")
Set oFile = oFileUpEE.Files("myFile")
oFile.Description = "Uploaded file"
oFile.Save
...
Top
|
DestinationFileExists |
Syntax
objFileEe.DestinationFileExists(File Name as String)
Description
DestinationFileExists returns true if a file with the same
name as the specified file exists in the destination directory. You can use this
property to find out if a file with the same name exists before setting
CreateUniqueFileName .
Top
|
DestinationFileName |
Syntax
objFileUpEE(Key).DestinationFileName [=File Name]
Description
DestinationFileName specifies the name with which to save an uploaded
file. DestinationFileName does not include a directory path. If you
assign DestinationFileName , use FileUpEE.DestinationDirectory
to set the Save directory. If you do not set the DestinationFileName of the file,
the DestinationFileName property will return nothing.
Alternatively, use DestinationPath .
Example
In ASP.NET:
[C#]
objFileUpEE.DestinationDirectory = @"C:\Uploads\Images\";
objFileUpEE[1].DestinationFileName = "image1.jpg";
[VB.NET]
objFileUpEE.DestinationDirectory = "C:\Uploads\Images\"
objFileUpEE(1).DestinationFileName = "image1.jpg"
In ASP:
[VBScript]
objFileUpEE.DestinationDirectory = "C:\Uploads\Images\"
objFileUpEE(1).DestinationFileName = "image1.jpg"
Top |
DestinationPath |
Syntax
objFileUpEE(Key).DestinationPath [=Server Path & File Name]
Description
When uploading a file to a directory, set DestinationPath to the Save
location. Set DestinationPath to a complete directory path and file
name.
DestinationPath is a Read/Write property.
Alternatively, use FileUpEE.DestinationDirectory
with DestinationFileName .
Example
In ASP.NET:
[C#]
objFileUpEE[1].DestinationPath = @"C:\Uploads\Images\file.gif";
[VB.NET]
objFileUpEE(1).DestinationPath = "C:\Uploads\Images\file.gif"
In ASP:
[VBScript]
objFileUpEE(1).DestinationPath = "C:\Uploads\Images\file.gif"
Top |
DownloadedFileName |
Syntax
objFileEE.DownloadedFileName [=File Name]
Description
DownloadedFileName sets or returns the name of a downloaded file on
the client, without a path.
DownloadedFileName is a Read/Write property.
Top |
DownloadedPath |
Syntax
objFileEE.DownloadedPath [=Path & File Name]
Description
DownloadedPath sets or returns the path and name of a file to download
from the server.
DownloadedPath is a Read/Write property.
Top |
Error |
Syntax
objFileEE.Error
Description
Error returns an error message, if an error occurred when transferring
the specified file.
Error is a Read Only property.
Example
In ASP.NET:
[C#]
if (oFileEE.Processed == saSaveResult.saSaved)
{
Response.Write("Upload successful");
}
else
{
Response.Write("Upload failed");
Response.Write("File error string: " + oFileEE.Error + "<BR>");
Response.Write("File error code: " + oFileEE.ErrorCode + "<BR>");
}
[VB.NET]
If oFileEE.Processed = saSaveResult.saSaved Then
Response.Write("Upload successful")
Else
Response.Write("Upload failed")
Response.Write("File error string: " & oFileEE.Error & "<BR>")
Response.Write("File error code: " & oFileEE.ErrorCode & "<BR>")
End If
In ASP:
[VBScript]
If oFileEE.Processed = saSaved Then
Response.Write "Upload successful"
Else
Response.Write "Upload failed"
Response.Write "File error string: " & oFileEE.Error & "<BR>"
Response.Write "File error code: " & oFileEE.ErrorCode & "<BR>"
End If
Top |
ErrorCode |
Syntax
objFileEe.ErrorCode
Description
ErrorCode returns a system error code,
if an error occurred when transferring the specified file.
ErrorCode is a Read Only property.
Example
In ASP.NET:
[C#]
if (oFile.Processed == saSaveResult.saSaved)
{
Response.Write("Upload successful");
}
else
{
Response.Write("Upload failed");
Response.Write("File error string: " + oFile.Error + "<BR>");
Response.Write("File error code: " + oFile.ErrorCode + "<BR>");
}
[VB.NET]
If oFile.Processed = saSaveResult.saSaved Then
Response.Write("Upload successful")
Else
Response.Write("Upload failed")
Response.Write("File error string: " & oFile.Error & "<BR>")
Response.Write("File error code: " & oFile.ErrorCode & "<BR>")
End If
In ASP:
[VBScript]
If oFile.Processed = saSaved Then
Response.Write "Upload successful"
Else
Response.Write "Upload failed"
Response.Write "File error string: " & oFile.Error & "<BR>"
Response.Write "File error code: " & oFile.ErrorCode & "<BR>"
End If
Top
|
FileMethod |
Syntax
objFileEE.FileMethod [=saFileMethod]
Description
For server-to-server file transfers, FileMethod sets the transfer type.
FileMethod is a Read/Write property.
Parameter
Set FileMethod to an saFileMethod name or number:
saFileMethod Values |
saUpload |
0 |
saDownload |
1 |
saRoundtrip |
2 |
Top
|
FormName |
Syntax
objFileEe.FormName [= String]
Description
FormName returns the name of the HTML form field from which the specified
file was uploaded.
FormName is a Read/Write property.
Example
In the upload form, if the file field is:
<input type="file" name="myFile">
oFileEe.FormName will return "myFile".
Top
|
Name |
Syntax
objFileEe.Name [= String]
Description
When uploading a file from a web form, Name returns the the value of
the <INPUT> field's name attribute. For example,
if a file is uploaded from <INPUT type="file" name="file1"> ,
its objFileEe.Name value will be "file1" .
To reference a single file in a multi-file upload, you can use the value of Name
as the file's key.
Name is a Read/Write property.
Example
In ASP.NET:
[C#]
FileUpEE objFileUpEE = new FileUpEE();
...
objFileUpEE[1].Name = "FirstFile";
objFileUpEE["FirstFile"].OverwriteFile = false;
...
[VB.NET]
Dim objFileUpEE As New FileUpEE()
...
objFileUpEE(1).Name = "FirstFile"
objFileUpEE("FirstFile").OverwriteFile = False
...
In ASP:
[VBScript]
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
...
objFileUpEE(1).Name = "FirstFile"
objFileUpEE("FirstFile").OverwriteFile = False
...
Top |
OverwriteFile |
Syntax
objFileEe.OverwriteFile [= Boolean]
Description
When set to true , an uploaded file will overwrite an existing file with the same
name. When set to false , the uploaded file will not be saved if a file with the
same name exists.
OverwriteFile is a Read/Write property, and is set to true by
default.
See Also
Top |
Params |
Syntax
objFileEe.Params.Add Param Name, Param Value
Description
Params is a key/value collection that may be used to send custom values with a SOAP
request from web server to file server.
Params is a Read Only property.
Top |
PreserveMacBinary |
Syntax
objFileEe.PreserveMacBinary
Description
PreserveMacBinary returns a boolean. PreserveMacBinary
is a Read Only property.
Note: In order to set PreserveMacBinary on an upload request,
you must set it on the FileUpEE object. It is important to understand that this
property is not effective when the HttpModule is being used.
When it is not implemented and PreserveMacBinary is set to true,
a file 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.
Example
In ASP.NET:
[C#]
if (oFileEE.PreserveMacBinary)
{
Response.Write("The first uploaded file is set to have both " +
"the data and resource forks preserved.");
}
else if (!oFileEE.PreserveMacBinary)
{
Response.Write("The first uploaded file is NOT set to have " +
"both the data and resource forks preserved.");
}
[VB.NET]
If oFileEE.PreserveMacBinary = True Then
Response.Write("The first uploaded file is set to have both " & _
"the data and resource forks preserved.")
ElseIf oFileEE.PreserveMacBinary = False Then
Response.Write("The first uploaded file is NOT set to have " & _
"both the data and resource forks preserved.")
End If
In ASP:
[VBScript]
If (oFileEE.PreserveMacBinary = True) Then
Response.Write("The first uploaded file is set to have both " & _
"the data and resource forks preserved.")
ElseIf (oFileEE.PreserveMacBinary = False) Then
Response.Write("The first uploaded file is NOT set to have " & _
"both the data and resource forks preserved.")
End If
Top |
PreviousChecksum |
Syntax
objFileEe.PreviousChecksum
Description
FileUpEE allows you to verify the integrity of data uploaded from web server to file
server. If FileEe.UseChecksum is enabled on the
web server, FileUpEE will generate a file content checksum for the specified file
and send the file's checksum with the upload to the file server. On the file server,
use FileEe.ValidateChecksum to verify that the data
was not corrupted during transfer.
PreviousChecksum contains the file content checksum that was generated
on the web server, before the upload was sent to the file server.
PreviousChecksum is a Read Only 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-upload checksums, see FileUpEE.UseChecksum
and FileUpEE.ValidateChecksums .
For more information on using per-file checksums, see FileEe.Checksum ,
FileEe.UseChecksum , and FileEe.ValidateChecksum .
Top |
Processed |
Syntax
objFileEe.Processed [=saSaveResult]
Description
Specifies the status of an upload. Check the FileEE.Processed property after calling FileEE.Save
to check the status of the file.
Processed is a Read/Write property.
Parameter
saSaveResult Values |
saSaved |
0 |
Uploaded file saved. |
saDownloaded |
0 |
File downloaded.
Use this value to check the success of a server-to-server download. You cannot use
this value to verify that a download was processed successfully on a client. |
saExists |
1 |
The file was not saved because OverwriteFile is set
to false and a file with the same name exists in the destination directory. |
saError |
2 |
An error occurred. |
saEmpty |
3
|
No file was submitted for upload. |
saUnknown |
4
|
An unknown error occurred. |
saNoAction |
5 |
No action was taken. This may occur when trying to save to a directory that does
not exist when the CreateDirectoryPath property is set to false , which
is its default value. |
Example
The following example displays an error message to the user if Processed
returns 2 (saError ).
In ASP.NET:
[C#]
foreach FileEe file in objFileUpEE.Files
{
...
file.Save();
If (file.Processed == 2)
{
Response.Write("Error uploading " +
file.ClientFileName + ":<br>");
Response.Write(file.Error );
}
...
}
[VB.NET]
For Each file As FileEe In objFileUpEE.Files
...
file.Save()
If file.Processed = 2 Then
Response.Write("Error uploading " & _
file.ClientFileName & ":<br>")
Response.Write(file.Error )
End if
...
Next
In ASP:
[VBScript]
For each file in objFileUpEE.Files
...
file.Save
If file.Processed = 2 then
Response.Write "Error uploading " & _
file.ClientFileName & ":<br>"
Response.Write file.Error
End if
...
Next
Top |
RelativeName |
Syntax
objFileEe.RelativeName
Description
XFileEE allows you to upload a directory
from the client. With each file in a directory upload, XFileEE sends an X-RelativeFileName
header which contains the file's directory path. For example if you upload the directory
\Folder, and \Folder contains the file File.ext, the value of X-RelativeFileName
will be "\Folder\File.ext".
A file's RelativeName property returns the value of the file's X-RelativeFileName
header, if the file was submitted through a directory upload from XFileEE. RelativeName
allows you to save an uploaded directory and maintain the original directory structure.
In a directory upload from client to web server, to process the upload on the server,
iterate over the FileUpEE.Files
collection, and use RelativeName to specify the file paths. For example:
In ASP.NET:
[C#]
oFileUpEE.DestinationDirectory = @"C:\Uploads\";
foreach (FileEe File in oFileUpEE.Files)
{
File.SaveAs(File.RelativeName);
}
[VB.NET]
oFileUpEE.DestinationDirectory = "C:\Uploads\"
For Each File As FileEe In oFileUpEE.Files
File.SaveAs(File.RelativeName)
Next
In ASP:
[VBScript]
oFileUpEE.DestinationDirectory = "C:\Uploads\"
For each File in Files
File.SaveAs File.RelativeName
Next
In a 3-tier directory upload from client (using XFileEE) to web server to file server,
where AutoProcess
is set to true on the file server, FileUpEE will automatically look for
each file's X-RelativeFileName header and save the files according to their
original directory paths. In this case, it is not necessary to get the value of
RelativeName or set the file paths in code.
RelativeName is a Read Only property.
Top |
SaveMethod |
Syntax
objFileEE.SaveMethod [= saSaveMethod]
Description
SaveMethod specifies whether an uploaded file will be saved to a file
directory or in a database. SaveMethod is a Read/Write property.
Parameter
Set SaveMethod to an saSaveMethod by name or number:
saSaveMethod Values |
saDatabase |
0 |
saDiskFile |
1 (Default value) |
See Also
Example
In ASP.NET:
[C#]
objFileUpEE[1].SaveMethod = saSaveMethod.saDatabase;
objFileUpEE.DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=C:\Uploads\files.mdb;" +
"Persist Security Info=False";
objFileUpEE.DbTableName = "Images";
String dbFileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].DbSchema.Add("File Name", dbFileName);
...
[VB.NET]
objFileUpEE(1).SaveMethod = saSaveMethod.saDatabase
objFileUpEE.DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Uploads\files.mdb;" & _
"Persist Security Info=False"
objFileUpEE.DbTableName = "Images"
Dim dbFileName As String = objFileUpEE(1).ClientFileName
objFileUpEE(1).DbSchema.Add("File Name", dbFileName)
...
In ASP:
[VBScript]
objFileUpEE(1).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(1).ClientFileName
objFileUpEE(1).DbSchema.Add "File Name", dbFileName
...
Top |
ServerFileName |
Syntax
objFileEe.ServerFileName
Description
ServerFileName returns a string representing the name of the file on the server.
ServerFileName is a Read Only property.
Top |
Size |
Syntax
objFileEe.Size
Description
Size returns the size of the uploaded file, in bytes.
Size is a Read Only property.
Note
FileUpEE can read the size of a file on the server before a download or
after an upload. Size cannot be used for client-side file size filtering.
Top |
TempFile (ASP only) |
Syntax
objFileEe.TempFile [= Temp Directory]
Description
When a file is uploaded to a server, it is cached. TempFile specifies
the uploaded file's temporary directory and name on the server. In ASP, the default
behavior is for uploads to be cached in the system's default directory for cached
files, typically c:\windows\temp; in ASP.NET, the temporary directory is set using
the HttpModule application key setting FileUpEETempDir.
After the file is saved, the value of TempFile is the same as the value
of DestinationPath .
TempFile is a Read only property.
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 .
Top |
UseChecksum |
Syntax
objFileUpEE.UseChecksum [= Boolean]
Description
FileUpEE 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 specified file and send the file's
checksum with the upload to the file server. On the file server, use FileEe.ValidateChecksum
to verify that the data was not corrupted during transfer.
In very large uploads, generating a checksum for each file can take so long that
the upload may fail. Enabling UseChecksum is not recommended for very
large uploads.
UseChecksum is a Read/Write property.
See Also
Top |
FileEe Methods |
Download |
Syntax
objFileEe.Download
Description
When downloading a file from a file server to a web server, if in the file server
script AutoProcess is set to
false , call Download .
Call Download after setting ClientPath
and DownloadedPath . Call Download before
calling SendResponse .
Example
In the following example the download request is sent from web server to file server,
but the download source and destination directories are set on the file server.
Since the file server script does not automatically execute instructions from the
web server script, AutoProcess
is set to false , and the file server script must call download .
web server script:
In ASP.NET:
[C#]
FileUpEE objFileUpEE = new FileUpEe();
objFileUpEE.ProcessRequest(Page.Request, true, false);
//--- You can pass empty strings to AddDownloadFile, and
//--- set the download source and destination directories
//--- on the file server.
objFileUpEE.AddDownloadFile("", "");
objFileUpEE.TargetUrl = @"http://localhost/fileupee/Download/DownloadFS.aspx";
objFileUpEE.SendRequest(Response);
[VB.NET]
Dim objFileUpEE As New FileUpEe()
objFileUpEE.ProcessRequest(Page.Request, True, False)
'--- You can pass empty strings to AddDownloadFile, and
'--- set the download source and destination directories
'--- on the file server.
objFileUpEE.AddDownloadFile("", "")
objFileUpEE.TargetUrl = "http://localhost/fileupee/Download/DownloadFS.aspx"
objFileUpEE.SendRequest(Response)
In ASP:
[VBScript]
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEe")
objFileUpEE.ProcessRequest Request, True, False
'--- You can pass empty strings to AddDownloadFile, and
'--- set the download source and destination directories
'--- on the file server.
objFileUpEE.AddDownloadFile "", ""
objFileUpEE.TargetUrl = "http://localhost/fileupee/Download/DownloadFS.asp"
objFileUpEE.SendRequest Response
File server script:
In ASP.NET:
[C#]
FileUpEE objFileUpEE = new FileUpEe();
objFileUpEE.ProcessRequest(Page.Request, true, false);
//--- Source path:
objFileUpEE[1].DownloadedPath = @"c:\images\file.gif";
//--- Destination path:
objFileUpEE[1].ClientPath = @"c:\downloads\file.gif";
objFileUpEE[1].Download();
objFileUpEE.SendResponse(Response);
Response.End();
[VB.NET]
Dim objFileUpEE As New FileUpEe()
objFileUpEE.ProcessRequest(Page.Request, True, False)
'--- Source path:
objFileUpEE(1).DownloadedPath = "c:\images\file.gif"
'--- Destination path:
objFileUpEE(1).ClientPath = "c:\downloads\file.gif"
objFileUpEE(1).Download()
objFileUpEE.SendResponse(Response)
Response.End()
In ASP:
[VBScript]
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEe")
objFileUpEE.ProcessRequest Request, True, False
'--- Source path:
objFileUpEE(1).DownloadedPath = "c:\images\file.gif"
'--- Destination path:
objFileUpEE(1).ClientPath = "c:\downloads\file.gif"
objFileUpEE(1).Download
objFileUpEE.SendResponse Response
Response.End
Top |
Save |
Syntax
objFileEE.Save()
Description
Saves an uploaded file to a directory or a database, depending on the value of SaveMethod .
When saving to a directory, set either FileEe.DestinationPath
or FileUpEE.DestinationDirectory
and FileEe.DestinationFileName .
For instructions on saving a file to a database (adding or updating a record), see
FileUpEE.DbConnection ,
FileUpEE.DbPrimaryKey , FileUpEE.DbPrimaryKeyValue ,
FileUpEE.DbSqlCommand ,
FileUpEE.DbTableName , FileEe.DbConnection ,
FileEe.DbPrimaryKey , FileEe.DbPrimaryKeyValue ,
FileEe.DbSchema FileEe.DbSqlCommand ,
and FileUpEE.DbTableName .
See Also
Example
In ASP.NET:
[C#]
FileUpEE objFileUpEE = new FileUpEE();
objFileUpEE.ProcessRequest(Request, false, false);
...
String FileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].DestinationPath = @"c:\temp\upload\" + FileName;
objFileUpEE[1].Save();
...
[VB.NET]
Dim objFileUpEE As New FileUpEE()
objFileUpEE.ProcessRequest(Request, False, False)
...
Dim FileName As String = objFileUpEE(1).ClientFileName
objFileUpEE(1).DestinationPath = "c:\temp\upload\" & FileName
objFileUpEE(1).Save()
...
In ASP:
[VBScript]
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request
...
FileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).DestinationPath = "c:\temp\upload\" & FileName
objFileUpEE(1).Save
...
Top |
SaveAs |
Syntax
objFileEE.SaveAs (Path & File Name)
Description
Saves a file to a directory specified by the method's FileName
parameter.
Example
In ASP.NET:
[C#]
FileUpEE objFileUpEE = new FileUpEE();
objFileUpEE.ProcessRequest(Request, false, false);
...
String FileName = objFileUpEE[1].ClientFileName;
objFileUpEE[1].SaveAs(@"c:\temp\upload\" + FileName);
[VB.NET]
Dim objFileUpEE As New FileUpEE()
objFileUpEE.ProcessRequest(Request, False, False)
...
Dim FileName As String = objFileUpEE(1).ClientFileName
objFileUpEE(1).SaveAs("c:\temp\upload\" & FileName)
In ASP:
[VBScript]
Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
objFileUpEE.ProcessRequest Request
...
FileName = objFileUpEE(1).ClientFileName
objFileUpEE(1).SaveAs "c:\temp\upload\" & FileName
Top |
SaveAsBlob |
Syntax
objFileEE.SaveAsBlob (Variant Blob)
Description
Saves a file to a database. You can also save to a database by setting SaveMethod to saDatabase and calling the
Save method.
There are two overloads for FileEE.SaveAsBlob(). The first takes a single parameter, an Object
representing the Blob into which you want the file uploaded. The second is available only in ASP.NET
using a SQL Database and takes three parameters:
a SqlCommand that provides a connection command to the SQL Server Database, a first SqlParameter as the
input parameter, and a second SqlParameter that provides an output parameter. In order to use the latter
overload, you will need to have ADO.NET components available from the server in which you have installed
FileUpEE. If multiple files are uploaded to be inserted into the database, the datarecord must be located
for each file in the collection and the appropriate SQLCommand object must be created for each file in the
collection.
Example
The following is an example of how to use FileEE.SaveAsBlob() to insert a single file into a
SQL Server Database. This database is named "Files" with a data table named
"FileSave". Within the "FileSave" data table is an integer column named "FileID" and a
BLOB column named "FileData". The example code will upload a file into the blob column
row corresponding with the "FileID" value of "35".
This example assumes that only one file is uploaded and inserted into the database. The database transaction
reads directly from the temporary file that was saved by the FileUpEEModule filter and inserts the file into
the database column for the record identified.
[C#]
FileEe oFile = oFileUpEE.Files[FTDEV:"file1"];
try
{
//--- create a connection to the database
SqlConnection cn = new SqlConnection("Data Source=<Your Server Name>;Persist Security Info=False;
User ID=<your user id>;pwd=<your password>;Initial Catalog=Files;");
cn.Open();
//--- locate the record to be updated and set the first byte in the
//--- FileData column to NULL, and retrieve a pointer to the starting
//--- byte in the blob column. This example uses the record where the
//--- value of the FileID column is '35'
String strSql = "SET NOCOUNT ON;UPDATE FileSave SET FileData = 0x0 WHERE FileID=35;
SELECT @Pointer=TEXTPTR(FileData) FROM FileSave WHERE FileID=35";
SqlCommand cmdGetPointer = new SqlCommand(strSql, cn);
SqlParameter pCategoryIdParam = cmdGetPointer.Parameters.Add("@FileID", SqlDbType.Int);
pCategoryIdParam.Value = 35;
SqlParameter OutParam = cmdGetPointer.Parameters.Add("@Pointer", SqlDbType.VarBinary, 100);
OutParam.Direction = ParameterDirection.Output;
//--- Open the row with the 'UPDATE' sql command and get a 'TEXTPTR'
//--- pointer to the blob column.
intnRows = cmdGetPointer.ExecuteNonQuery();
//--- Verify that the row was opened.
if(OutParam.Value == System.DBNull.Value)
{
Response.Write("Failed to open row");
cn.Close();
return;
}
//--- Create an System.Data.SqlClient.SqlCommand reference using the
//--- 'UPDATETEXT' sql command, creating 'Pointer', 'Offset', and 'Delete'
//--- parameters so that FileEE can properly chunk data to the database column.
SqlCommand pSqlCmd = new SqlCommand("UPDATETEXT FileSave.FileData @Pointer @Offset @Delete WITH LOG @Bytes", cn);
SqlParameter InParam = pSqlCmd.Parameters.Add("@Pointer", SqlDbType.Binary, 16);
//--- call SaveAsBlob to read the file in chunks and
//--- update the column in the database.
oFile.SaveAsBlob(pSqlCmd, InParam, OutParam);
//--- Close the database connection.
cn.Close();
}
catch(Exception exc)
{
Response.Write(exc.ToString());
}
[VB.NET]
FileEe oFile = oFileUpEE.Files(FTDEV:"file1");
Try
'--- create a connection to the database
Dim cn As New SqlConnection("Data Source=<Your Server Name>;Persist Security Info=False;" & _
"User ID=<your user id>;pwd=<your password>;Initial Catalog=Files;")
cn.Open()
'--- locate the record to be updated and set the first byte in the
'--- FileData column to NULL, and retrieve a pointer to the starting
'--- byte in the blob column. This example uses the record where the
'--- value of the FileID column is '35'
String strSql = "SET NOCOUNT ON;UPDATE FileSave SET FileData = 0x0 WHERE FileID=35;" & _
"SELECT @Pointer=TEXTPTR(FileData) FROM FileSave WHERE FileID=35"
Dim cmdGetPointer As New SqlCommand(strSql, cn)
Dim pCategoryIdParam As SqlParameter = cmdGetPointer.Parameters.Add("@FileID", SqlDbType.Int)
pCategoryIdParam.Value = 35
Dim OutParam As SqlParameter = cmdGetPointer.Parameters.Add("@Pointer", SqlDbType.VarBinary, 100)
OutParam.Direction = ParameterDirection.Output
'--- Open the row with the 'UPDATE' sql command and get a 'TEXTPTR'
'--- pointer to the blob column.
intnRows = cmdGetPointer.ExecuteNonQuery()
'--- Verify that the row was opened.
If OutParam.Value = System.DBNull.Value Then
Response.Write("Failed to open row")
cn.Close()
Return
End If
'--- Create an System.Data.SqlClient.SqlCommand reference using the
'--- 'UPDATETEXT' sql command, creating 'Pointer', 'Offset', and 'Delete'
'--- parameters so that FileEE can properly chunk data to the database column.
Dim pSqlCmd As New SqlCommand("UPDATETEXT FileSave.FileData @Pointer @Offset @Delete WITH LOG @Bytes", cn)
Dim InParam As SqlParameter = pSqlCmd.Parameters.Add("@Pointer", SqlDbType.Binary, 16)
'--- call SaveAsBlob to read the file in chunks and
'--- update the column in the database.
oFile.SaveAsBlob(pSqlCmd, InParam, OutParam)
'--- Close the database connection.
cn.Close()
Catch exc As Exception
Response.Write(exc.ToString())
End Try
Top |
ValidateChecksum |
Syntax
objFileEE.ValidateChecksum
Description
Use ValidateChecksum to verify the integrity of data transferred from
web server to file server. If FileEe.UseChecksum
is set to true on the web server, FileUpEE will generate a content checksum for
the specified file 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 file content checksum received from the web server and the checksum generated
on the file server are identical, ValidateChecksums returns true . If
the file checksums are not identical, the file was corrupted during transfer, and
ValidateChecksum returns false .
See Also
You can generate and validate a content checksum for a single file or for the whole
upload. For information on using per-upload checksums, see FileUpEE.UseChecksum
and FileUpEE.ValidateChecksums .
For more information on using per-file checksums, see FileEe.Checksum ,
FileEe.PreviousChecksum , and FileEe.UseChecksum .
Top |
WriteToResponse |
Syntax
objFileEE.WriteToResponse(Response)
Description
WriteToResponse writes the specified file to the ASP Response.
Using WriteToResponse in a Server-to-Client Download
When downloading a file from a web server to a client using
FileUpEE.AddDownloadFile , use WriteToResponse
to send the file to the browser. For an example using the FileUpEE.AddDownloadFile method, see
A Simple Download. Note that the
FileUpEE.TransferFile method
is the recommended method for performing FileUpEE downloads.
Using WriteToResponse in a Server-to-Server-to-Client Download
WriteToResponse allows you to include operations in script that will
be executed between a file's arrival on the web server and its transfer to the client.
If in the web server script, you pass the ASP Request object to
SendRequest , the file will be downloaded from the file server to the web
server, and immediately sent to the client. If you do not pass the ASP Request object
to SendRequest , the file will be downloaded to the web server, but
will not be sent to the client. Later in the script, you can use WriteToResponse
to send the file to the client.
Note
To let the browser know how to handle a download, set the content-type response
header to the file's ContentType before sending the file
to the browser.
Example
The following is the web server script in a download from file server to web server
to client. The script gets the download source and destination directories from
a form.
[VBScript]
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()
...
'--- Script included between SendRequest() and WriteToResponse
'--- will be executed after a file is downloaded to the web
'--- server but before it is transferred to the client.
...
If objFileUpEE(1).Processed = saSaved then
objFileUpEE(1).WriteToResponse(Response)
End if
Top |