Class Upload
A service that handles the uploaded files
public
|
|
public
boolean
|
|
protected
boolean
|
|
public
string
|
|
public
|
|
public
string
|
|
protected
string
|
#
getIniSize( string $name )
Returns a human readable file size (e.g. 1.2MB, 10KB), which recive from the ini configuration |
protected
boolean
|
#
isUploadedFile( string $file )
Check if the file was uploaded via HTTP POST, if $this->unitTest is enable, it will always return true |
protected
boolean
|
#
moveUploadedFile( string $from, string $to )
Moves an uploaded file to a new location, if $this->unitTest is enable,
it will use |
doValidate()
|
convertToArray(),
fromBytes(),
getExt(),
getMimeType(),
inMimeType(),
setExcludeExts(),
setExcludeMimeTypes(),
setExts(),
setMaxSize(),
setMimeTypes(),
setMinSize(),
toBytes()
|
__call(),
__get(),
getOption(),
setOption()
|
t()
|
protected
string
|
$postSizeMessage
Seems that the total post data size is too large |
#
'No file uploaded or the total file size is too large, allowed maximum size is %postMaxSize%'
|
protected
string
|
$noFileMessage
The uploaded file array do not contain the key "$this->field", or error code not available |
#
'No file uploaded, please select a file to upload'
|
protected
string
|
$formLimitMessage
|
#
'%name% is larger than the MAX_FILE_SIZE value in the HTML form'
|
protected
string
|
$partialMessage
|
#
'%name% was partial uploaded, please try again'
|
protected
string
|
$noTmpDirMessage
|
#
'The temporary upload directory is missing'
|
protected
string
|
$cantWriteMessage
|
#
'Cannot write %name% to disk'
|
protected
string
|
$extensionMessage
|
#
'File upload stopped by extension'
|
protected
string
|
$notUploadedFileMessage
|
#
'No file uploaded'
|
protected
string
|
$cantMoveMessage
|
#
'Cannot move uploaded file'
|
protected
string
|
$name
The name for error message |
#
'file'
|
protected
string
|
$field
The name defined in the file input, if it's not specified, use the first key in upload files array (equals to $_FILES on default) |
|
protected
string
|
$dir
The directory to save file, automatic create it if not exist |
#
'uploads'
|
protected
string
|
$fileName
The custom file name (without extension) as upload file name to save |
|
protected
boolean
|
$isImage
Whether check if the upload file is valid image or not |
#
false
|
protected
boolean
|
$overwrite
Whether overwrite existing file, if set to false, the uploader will add a number between file name and extension, like file-1.jpg, file-2.jpg |
#
false
|
protected
boolean
|
$unitTest
Whether in unit test mode |
#
false
|
protected
string
|
$postMaxSize
The max size of post data, for $this->postMaxSize |
$height,
$heightTooBigMessage,
$heightTooSmallMessage,
$maxHeight,
$maxWidth,
$minHeight,
$minWidth,
$notDetectedMessage,
$width,
$widthTooBigMessage,
$widthTooSmallMessage
|
$errors,
$negative,
$notStringMessage,
$validator
|
$providers,
$wei
|
public
|
$request
The HTTP request wei |
$t
|