\Examples\ControllersUploadFile

The Uploader class, the base AJAX Controller for Uploader plugin.

An AJAX controller class may extends from Uploader controller class, or stores it as a property.

Summary

Methods
Properties
Constants
upload()
flush()
abort()
debug()
chkExt()
uploadFiles()
uploadFile()
chkLength()
error()
__construct()
getAJAX()
post()
sendfile()
triggerError()
No public properties found
No constants found
No protected methods found
$ajax
N/A
No private methods found
$error
$post
$options
$files
$uploadCount
N/A

Properties

$ajax

$ajax : \CJAX\Core\CJAX

The ajax property, stores an instance of CJAX for child controllers to use easily.

Type

\CJAX\Core\CJAX

$error

$error : string

The error property, stores the error message for Uploader if action fails.

Type

string

$post

$post : array

The posts property, stores a list of posted/saved files.

Type

array

$options

$options : array

The options property, specifies an array of options for uploader.

Type

array

$files

$files : array

The files property, stores a list of files for uploader.

Type

array

$uploadCount

$uploadCount : array

The uploadCount property, specifies the number of files uploaded.

Type

array

Methods

upload()

upload() : void

The upload method, it is called to handle file upload operation.

flush()

flush() : void

The flush method, removes caches and resets the plugin object.

abort()

abort(  $error) : void

The abort method, aborts file upload operation and exits script execution.

Parameters

$error

debug()

debug(array  $options) : void

The abort method, it is used to debug uploader plugin and checks server environment.

Parameters

array $options

chkExt()

chkExt(string  $filename) : boolean

The chkExt method, checks if the file has valid extension for uploading.

Parameters

string $filename

Returns

boolean

uploadFiles()

uploadFiles(boolean  $filesFount, array  $files) : void

The uploadFiles method, handles the file uploading operation for all files.

Parameters

boolean $filesFount
array $files

uploadFile()

uploadFile(string  $tmpname, string  $filename) : boolean

The uploadFile method, carries out file upload operation by moving temporary files.

Parameters

string $tmpname
string $filename

Returns

boolean

chkLength()

chkLength() : void

The chkLength method, checks if the length of file is valid.

This method will not return boolean value, it terminates script execution if length check fails.

error()

error(integer  $errorNo, string  $fileName, integer  $size) : string

The error method, triggers an error message for failed file uploading actions.

Parameters

integer $errorNo
string $fileName
integer $size

Returns

string

__construct()

__construct(\CJAX\Core\CJAX  $ajax) : \CJAX\Core\AJAXController

The constructor for AJAXController class, it instantiates controller class with property $ajax through DI.

Parameters

\CJAX\Core\CJAX $ajax

Returns

\CJAX\Core\AJAXController

getAJAX()

getAJAX() : \CJAX\Core\CJAX

The getCJAX method, acquires the instance of $ajax from controller.

Returns

\CJAX\Core\CJAX

post()

post(  $files) 

Parameters

$files

sendfile()

sendfile(\Examples\Controllers\unknown_type  $file_names = null) 

Parameters

\Examples\Controllers\unknown_type $file_names

triggerError()

triggerError()