SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class FileUploadController

Handles file uploads in chunks using the JS File API and XMLHttpRequest

Functions

NameVisibilityDescription
chunkSizeCheckpublicPerform a size check on a set of uploaded chunks.
cleanupChunksprotectedClean up any left-over chunks
clearSessionpublic 
extraChunkCheckpublicPerform additional checks (beyond the checks already in FileUploadController::uploadChunk) on an uploaded chunk.
fileExtCheckpublicPerform a file extension check.
fileSizeCheckpublicPerform a size check on a completed upload (after chunks have been stitched).
sessionpublicGets the session data associated with a file upload
startSessionprotectedCreates a session record for a new file upload, and configures its initial state
stitchChunksprivateStitch together the uploaded file from multiple chunks
uploadBeginpublicSignals that the user would like to upload a file
uploadCancelpublicCancel an upload - delete temporary files.
uploadChunkpublicSave a single chunk of a multi-part file upload
uploadDonepublicStitch together uploaded chunks into an actual file
uploadFormpublicReturns the form for updating a file which has been uploaded
validateCodeprotectedChecks POSTed code matched the expected format

public chunkSizeCheck

void $FileUploadController->chunkSizeCheck ( );

Perform a size check on a set of uploaded chunks.
To be implemented by subclasses

protected cleanupChunks

void $FileUploadController->cleanupChunks ( string $code , int $num_chunks );

Clean up any left-over chunks

public clearSession

void $FileUploadController->clearSession ( );

This function does not have a description

public extraChunkCheck

void $FileUploadController->extraChunkCheck ( );

Perform additional checks (beyond the checks already in FileUploadController::uploadChunk) on an uploaded chunk.
To be implemented by subclasses

public fileExtCheck

void $FileUploadController->fileExtCheck ( mixed $temp_path );

Perform a file extension check.
To be implemented by subclasses

public fileSizeCheck

void $FileUploadController->fileSizeCheck ( string &$temp_path );

Perform a size check on a completed upload (after chunks have been stitched).
To be implemented by subclasses

public session

&array $FileUploadController->session ( );

Gets the session data associated with a file upload

protected startSession

&array $FileUploadController->startSession ( );

Creates a session record for a new file upload, and configures its initial state

private stitchChunks

int $FileUploadController->stitchChunks ( string $dest_filename , string $code , string $num_chunks );

Stitch together the uploaded file from multiple chunks

public uploadBegin

void $FileUploadController->uploadBegin ( );

Signals that the user would like to upload a file
Perform basic sanity checks and establish (or reset) their session state

public uploadCancel

void $FileUploadController->uploadCancel ( );

Cancel an upload - delete temporary files.

May receive two different variations on the provided POST data:
   [result][tmp_file]       Whole file was uploaded
   [partial_upload][code]   Only some chunks of the file have been uploaded

public uploadChunk

void $FileUploadController->uploadChunk ( );

Save a single chunk of a multi-part file upload

public uploadDone

void $FileUploadController->uploadDone ( );

Stitch together uploaded chunks into an actual file

Outputs a JSON response.
The field "success" will be checked (= 1) to determine success.
On error, the field "message" will be used as an error message.
Other keys provided are passed to the ajaxDragdropForm method.

public uploadForm

void $FileUploadController->uploadForm ( );

Returns the form for updating a file which has been uploaded

protected validateCode

string $FileUploadController->validateCode ( );

Checks POSTed code matched the expected format