The FileCollection Object

The FileCollection object represents the set of files in a file transfer. To set a FileCollection object, use:

In ASP.NET (C#):

FileUpEE objFileUpEE = new FileUpEE();
FileCollection objFileCollection = objFileUpEE.Files;
    

In ASP:

Set objFileUpEE = Server.CreateObject("SoftArtisans.FileUpEE")
Set objFileCollection = objFileUpEE.Files
FileCollection Properties     FileCollection Methods
Count Add
Item AddDbDownloadFile
AddDownloadFile
AddFile
AddFileEE
Remove
RemoveAll
FileCollection Properties
Count
Syntax
objFileCollection.Count
Description

Returns the number of files in a FileCollection .

Count is a Read Only property.

Top

Item
Syntax
objFileCollection[.Item](Key)
Desription

Item represents a single FileEE object in a FileCollection. Item is the default property of FileCollection , therefore, FileCollection(2) is equivalent to FileCollection.Item(2) . Item numbers are 0-based.

Item is a Read Only property.

Top



FileCollection Methods
Add
Syntax
objFileCollection.Add(FileBuffer, [Name], [ContentId], Overwrite as Boolean)
Description

Use Add to add a byte array to an upload. For example, Add can be used to add a database BLOB to an upload as a file.

Top

AddDbDownloadFile
Syntax
objFileEE = objFileCollection.AddDbDownloadFile(ClientPath, [Name],[WebServerDownload as Boolean])
Description

AddDbDownloadFile adds a file from a database to the collection of files to download. AddDbDownloadFile takes the download destination directory 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. See the FileEE object's database properties.

Parameters
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:

objFileCollection("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

Top

AddDownloadFile
Syntax
objFileEE = objFileCollection.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:

objFileCollection("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

Top

AddFile
Syntax
objFileCollection.AddFile(FileName, [Name], [ContentId], [Overwrite as boolean])
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.
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:
objFileCollection.AddFile "C:\first.xls","AddedFile",1234
Default value: ""
Overwrite Optional. If set to true, the uploaded file will overwrite an existing file with the same name. If set to false, the uploaded file will not be saved if a file with the same name exists in the destination directory. Default value: True

Top

AddFileEE
Syntax
objFileCollection.AddFileEE (FileEE Instance, [ReadFile as Boolean], [DownloadFile as Boolean])
Description

AddFileEE adds an instance of the FileEE object to the file collection.

Top

Remove
Syntax
objFileCollection.Remove(File Key)
Description

Removes a file from the file collection. Remove takes one parameter: the file's key. The key may be either the file's Name property, or Item number.

Top

RemoveAll
Syntax
objFileCollection.RemoveAll()
Description

Removes all files from the file collection.

Top



Copyright © 2010 SoftArtisans, Inc. All rights reserved.