|
Ubiquity 2.5.2
php rapid development framework
|
File Uploader class utility. More...
Public Member Functions | |
| __construct ($destDir='upload') | |
| setUploadOptions (?array $allowedMimeTypes=null, int $maxFileSize=100000) | |
| getMaxFileSize () | |
| setMaxFileSize (int $maxFileSize) | |
| getAllowedMimeTypes () | |
| setAllowedMimeTypes (?array $allowedMimeTypes) | |
| allowImages (bool $only=true) | |
| allowAllMimeTypes () | |
| setMessageTypes (array $messages) | |
| Redefine the messages displayed. | |
| getMessageTypes () | |
| Get the message types displayed. | |
| upload (string $destDir=null, bool $force=true,?callable $filenameCallback=null) | |
| Uploads files to $destDir directory. | |
| hasErrors () | |
| Returns true if the upload generated at least one error. | |
| isSuccess () | |
| Returns true if at least one file has been uploaded. | |
| getMessages () | |
| Returns all success messages. | |
| getErrorMessages () | |
| Returns all error messages. | |
Data Fields | |
| const | SUCCESS_MESSAGE ='uploadSuccess' |
| const | NO_FILE_SENT_ERR ='uploadNoFileSentErr' |
| const | FILE_SIZE_ERR ='uploadFileSizeErr' |
| const | UNKNOWN_ERR ='uploadUnknownErr' |
| const | MIME_TYPE_ERR ='uploadMimeTypeErr' |
| const | EXISTING_FILE_ERR ='uploadExistingFileErr' |
| const | UPLOAD_ERR ='uploadErr' |
| const | INVALID_FORMAT_ERR ='uploadInvalidFormatErr' |
Private Member Functions | |
| allowType (bool $only, array $typeArray) | |
| checkErrors (array $file) | |
| getMessageType (string $type, string ... $params) | |
| checkTypeMime (array $file) | |
| checkFileSize (array $file) | |
| getDisplayedFileName (array $file) | |
Private Attributes | |
| const | IMAGES_MIME_TYPES =['bmp'=>'image/bmp','gif'=>'image/gif','ico'=>'image/vnd.microsoft.icon','jpg'=>'image/jpeg','jpeg'=>'image/jpeg','svg'=>'image/svg+xml','png'=>'image/png','tif'=>'image/tiff','tiff'=>'image/tiff'] |
| int | $maxFileSize =100000 |
| array | $allowedMimeTypes =['pdf'=>'application/pdf'] |
| array | $messages |
| string | $destDir |
| array | $messageTypes |
File Uploader class utility.
Ubiquity\utils\http$UFilesUpload This class is part of Ubiquity
Definition at line 19 of file UFilesUpload.php.
| __construct | ( | $destDir = 'upload' | ) |
Definition at line 46 of file UFilesUpload.php.
| allowAllMimeTypes | ( | ) |
Definition at line 91 of file UFilesUpload.php.
| allowImages | ( | bool | $only = true | ) |
Definition at line 87 of file UFilesUpload.php.
|
private |
Definition at line 95 of file UFilesUpload.php.
|
private |
Definition at line 103 of file UFilesUpload.php.
|
private |
Definition at line 136 of file UFilesUpload.php.
|
private |
Definition at line 124 of file UFilesUpload.php.
| getAllowedMimeTypes | ( | ) |
Definition at line 76 of file UFilesUpload.php.
|
private |
Definition at line 144 of file UFilesUpload.php.
| getErrorMessages | ( | ) |
| getMaxFileSize | ( | ) |
Definition at line 62 of file UFilesUpload.php.
| getMessages | ( | ) |
|
private |
Definition at line 120 of file UFilesUpload.php.
| getMessageTypes | ( | ) |
| hasErrors | ( | ) |
Returns true if the upload generated at least one error.
Definition at line 204 of file UFilesUpload.php.
| isSuccess | ( | ) |
Returns true if at least one file has been uploaded.
Definition at line 212 of file UFilesUpload.php.
| setAllowedMimeTypes | ( | ?array | $allowedMimeTypes | ) |
| array | string[] | null | $allowedMimeTypes |
Definition at line 83 of file UFilesUpload.php.
| setMaxFileSize | ( | int | $maxFileSize | ) |
| int | $maxFileSize |
Definition at line 69 of file UFilesUpload.php.
| setMessageTypes | ( | array | $messages | ) |
Redefine the messages displayed.
| array | $messages |
Definition at line 152 of file UFilesUpload.php.
| setUploadOptions | ( | ?array | $allowedMimeTypes = null, |
| int | $maxFileSize = 100000 |
||
| ) |
| array | null | $allowedMimeTypes | |
| int | $maxFileSize |
Definition at line 54 of file UFilesUpload.php.
| upload | ( | string | $destDir = null, |
| bool | $force = true, |
||
| ?callable | $filenameCallback = null |
||
| ) |
Uploads files to $destDir directory.
| string | null | $destDir | is relative to ROOT app |
| bool | $force | if True, replace existing files |
| callable | null | $fileNameCallback | returns an updated version of the dest filename i.e. function($filename){ return '_'.$filename;} |
Definition at line 170 of file UFilesUpload.php.
|
private |
Definition at line 32 of file UFilesUpload.php.
|
private |
Definition at line 34 of file UFilesUpload.php.
|
private |
Definition at line 31 of file UFilesUpload.php.
|
private |
Definition at line 33 of file UFilesUpload.php.
|
private |
Definition at line 35 of file UFilesUpload.php.
| const EXISTING_FILE_ERR ='uploadExistingFileErr' |
Definition at line 25 of file UFilesUpload.php.
| const FILE_SIZE_ERR ='uploadFileSizeErr' |
Definition at line 22 of file UFilesUpload.php.
|
private |
Definition at line 29 of file UFilesUpload.php.
| const INVALID_FORMAT_ERR ='uploadInvalidFormatErr' |
Definition at line 27 of file UFilesUpload.php.
| const MIME_TYPE_ERR ='uploadMimeTypeErr' |
Definition at line 24 of file UFilesUpload.php.
| const NO_FILE_SENT_ERR ='uploadNoFileSentErr' |
Definition at line 21 of file UFilesUpload.php.
| const SUCCESS_MESSAGE ='uploadSuccess' |
Definition at line 20 of file UFilesUpload.php.
| const UNKNOWN_ERR ='uploadUnknownErr' |
Definition at line 23 of file UFilesUpload.php.
| const UPLOAD_ERR ='uploadErr' |
Definition at line 26 of file UFilesUpload.php.