Upload Files Without COM

Created by Lewis Moten

http://www.lewismoten.com

The following is the structure of the interface when working the the Upload Class.


File Name: clsUpload.asp
Class Name: clsUpload

read-only property Count()

Returns number of fields retrieved from the posted form data.

read-only property Collection(fieldName)

Returns an array of field objects parsed from the form data that have the same field name.  Can be used with <SELECT> element with multiple options selected.

default read-only property

Fields(fieldName)
Fields(index)

Returns a clsField object that matches the name or ordinal index provided.

sub DeleteFile(filePath)

Deletes a file from the file system.

sub RenameFile(filePath, fileName)

Renames a file on the file system.

sub CopyFile(source, destination)

Copies a file from one location to another on the file system.

sub MoveFile(source, destination)

Moves a file from one location to anther on the file system.

function UniqueName(folder, proposedName)

Checks folder for existing file name.  If one exists, it will itterate through an index until a file name is not found.  For example, If a file Photo.gif exists, it may return Photo[1].gif, Photo[2].gif and so on until it finds a name that does not exist within the specified folder.

function DebugText

Returns HTML code used in debugging the information comming accross within the posted form data.

 

File Name: clsField.asp
Class Name: clsField

property Name

Name of the field defined in form

property FileDir

Directory that file existed in on visitors computer

C:\Documents and Settings\lmoten\Desktop

property

FileExt

Extension of the file

GIF, JPG, BMP, EXE, COM, VBS, Etc.

property FileName

Name of the file

Photo.gif

property ContentType

Content / Mime type of file

image/gif

property Length

Byte size of the value or binary data

property DataStart

Index where field data begins in posted data

property DataLength 

Binary Length of field data within posted data

read-only property BLOB 

Same thing as BinaryData but with a shorter name.  Added to help prevent confusion with database access.

read-only property BinaryData 

Contents of files binary data.  (Integer SubType Array)

function BinaryAsText 

Converts binary data into unicode format.  Useful when you expect the user to upload a text file and you have the need to interact with it.

sub SaveAs(fileName)

Saves binary data to a specified path.  This will overwrite any existing files.

property FilePath 

Path that file was sent from on visitors computer

 

File Name: clsProgress.asp
Class Name: clsProgress 

property TotalBytes

Number of bytes that visitor has uploaded to the webserver.

property BytesReceived

Number of bytes that the server has received from the visitor

property UploadStarted

Time that the upload process began

property UploadCompleted

Time that the upload process was completed

property LastActive

Time that the buffer was last read from.

function Load

Returns boolean determining if the information could be loaded.

sub Save

Saves upload information into a temporary file

 

Globals - defined within clsUpload.asp.  Page Scope accessable to clsUpload, clsFile, and clsProgress.

read-only property FileSystemObjectEnabled

Determines if the file system object may be used.  Some ISP's do not allow the use of the file system object, or only allow limited use.  Set this value to false if it is causing problems.

read-only property BufferSize

Defines the number of bytes to read at a time from the posted form data.  Default value is 64 KB.  Adjust this to fine-tune performance.

property gBinaryData

bytes visitor sent to server with posted form data.