FileUpload
LnBlogObject
FileUpload

Handles file uploads via HTTP POSTs.  Handling the upload is a three-step process.  First, you need to create an instance of the class, passing it the upload array and optional destination directory and upload array index.  After that, you check if the upload completed successfully, and based on that check, either move the file to the permanent location or emit an error message.

Events
OnInit

Fired when the object is created.

InitComplete

Fired after object is initialized.

OnMove

Fired before moving the uploaded file to its destination.

MoveComplete

Fired after the file is successfully moved.

Functions
status
function status()

Get a status code for the file upload.

Returns

An integer representing the upload status.

completed
function completed()

Determines the status of the upload.

Returns

True if the file uploaded without error, false otherwise.

moveFile
function moveFile()

Moves the file from the upload directory to the permanent location.

Retruns

True on success, false otherwise.

errorMessage
function errorMessage(
$errfalse
)

Gets a message associated with the status of the upload.

Parameters
err

Optional status code for which to get the message.  The default is to use the error property of the object.

Returns

A string containing the appropriate message.