Upload Class

package Fuel
category Core
link http://docs.fuelphp.com/classes/upload.html

 Methods

class initialisation, load the config and process $_FILES if needed

_init() 

Get the list of non-validated files

get_errors(mixed $index) : array

Parameters

$index

mixed

Returns

arraylist of uploaded files that failed to validate

Get the list of validated files

get_files(mixed $index) : array

Parameters

$index

mixed

Returns

arraylist of uploaded files that are validated

return the Upload instance

instance() : \Upload

Returns

\Upload

Check if we have valid files

is_valid() : bool

Returns

booltrue if static:$files contains uploaded files that are valid

Lang callback function, translates Upload error messages

lang_callback(int $error) : string

Parameters

$error

int

Number of the error message we want the language string for

Returns

stringLanguage string retrieved

Move callback function, custom method to move an uploaded file.

move_callback(string $from, string $to) : bool

In Fuel 1.x this method is used for FTP uploads only

Parameters

$from

string

The FQFN of the file to move

$to

string

The FQFN of the file destination

Returns

boolResult of the move operation

Process the uploaded files, and run the validation

process(array $config) : void

Parameters

$config

array

Register

register(string $event, mixed $callback) : void

Registers a Callback for a given event

Parameters

$event

string

The name of the event

$callback

mixed

callback information

save uploaded file(s)

save() : void

Upload files with FTP

with_ftp(string | array $config, bool $connect) 

Parameters

$config

stringarray

The name of the config group to use, or a configuration array.

$connect

bool

Automatically connect to this server.

 Properties

 

<p>FuelPHP\Upload\Upload object</p>

$upload : object

 

<p>Ftp object</p>

$with_ftp : object

 Constants

 

UPLOAD_ERR_CANT_WRITE

UPLOAD_ERR_CANT_WRITE 

 

UPLOAD_ERR_DUPLICATE_FILE

UPLOAD_ERR_DUPLICATE_FILE 

 

UPLOAD_ERR_EXTENSION

UPLOAD_ERR_EXTENSION 

 

UPLOAD_ERR_EXT_BLACKLISTED

UPLOAD_ERR_EXT_BLACKLISTED 

 

UPLOAD_ERR_EXT_NOT_WHITELISTED

UPLOAD_ERR_EXT_NOT_WHITELISTED 

 

UPLOAD_ERR_FORM_SIZE

UPLOAD_ERR_FORM_SIZE 

 

UPLOAD_ERR_FTP_FAILED

UPLOAD_ERR_FTP_FAILED 

 

UPLOAD_ERR_INI_SIZE

UPLOAD_ERR_INI_SIZE 

 

UPLOAD_ERR_MAX_FILENAME_LENGTH

UPLOAD_ERR_MAX_FILENAME_LENGTH 

 

UPLOAD_ERR_MAX_SIZE

UPLOAD_ERR_MAX_SIZE 

 

UPLOAD_ERR_MIME_BLACKLISTED

UPLOAD_ERR_MIME_BLACKLISTED 

 

UPLOAD_ERR_MIME_NOT_WHITELISTED

UPLOAD_ERR_MIME_NOT_WHITELISTED 

 

UPLOAD_ERR_MKDIR_FAILED

UPLOAD_ERR_MKDIR_FAILED 

 

UPLOAD_ERR_MOVE_FAILED

UPLOAD_ERR_MOVE_FAILED 

 

UPLOAD_ERR_NO_FILE

UPLOAD_ERR_NO_FILE 

 

UPLOAD_ERR_NO_TMP_DIR

UPLOAD_ERR_NO_TMP_DIR 

 

UPLOAD_ERR_OK

UPLOAD_ERR_OK 

 

UPLOAD_ERR_PARTIAL

UPLOAD_ERR_PARTIAL 

 

UPLOAD_ERR_TYPE_BLACKLISTED

UPLOAD_ERR_TYPE_BLACKLISTED 

 

UPLOAD_ERR_TYPE_NOT_WHITELISTED

UPLOAD_ERR_TYPE_NOT_WHITELISTED