Property | Type | Description | |
---|---|---|---|
$callbacks | array | Callbacks to be run | |
$fileContainer | FileUpload\File | File Container instance | |
$filename_generator | FileUpload\FileNameGenerator\FileNameGenerator | Path resolver instance | |
$files | array | The array of uploaded files | |
$filesystem | FileUpload\FileSystem\FileSystem | File system instance | |
$logger | Psr\Log\LoggerInterface | Optional logger | |
$messages | array | Default messages | |
$pathresolver | FileUpload\PathResolver\PathResolver | Path resolver instance | |
$server | array | $_SERVER | |
$upload | array | $_FILES | |
$validators | array | Validators to be run |
Method | Description | |
---|---|---|
__construct ( array $upload, array $server, FileUpload\FileNameGenerator\FileNameGenerator $generator = null ) | Construct this mother | |
addCallback ( string $event, Closure $callback ) | Register callback for an event | |
addValidator ( FileUpload\Validator\Validator $v ) | Add another validator | |
getFileContainer ( ) : FileUpload\File | ||
getFileNameGenerator ( ) : FileUpload\FileNameGenerator\FileNameGenerator | ||
getFileSystem ( ) : FileUpload\FileSystem\FileSystem | ||
getFiles ( ) : array | Returns an array of all uploaded files | |
getLogger ( ) : Psr\Log\LoggerInterface | ||
getMessage ( integer $code ) : string | Get an error message | |
getPathResolver ( ) : FileUpload\PathResolver\PathResolver | ||
processAll ( ) : array | Process entire submitted request | |
setFileNameGenerator ( FileUpload\FileNameGenerator\FileNameGenerator $fng ) | Set filename generator | |
setFileSystem ( FileUpload\FileSystem\FileSystem $fs ) | Set file system | |
setLogger ( Psr\Log\LoggerInterface $logger ) | Set logger, optionally | |
setMessages ( array $new_messages ) | Merge (overwrite) default error messages | |
setPathResolver ( FileUpload\PathResolver\PathResolver $pr ) | Set path resolver |
Method | Description | |
---|---|---|
fixIntegerOverflow ( integer $int ) : float | Ensure correct value for big integers | |
getConfigBytes ( string $val ) : float | Convert size format from PHP config into bytes | |
getContentLength ( ) : integer | Content-length header | |
getContentRange ( ) : array | Content-range header | |
getContentType ( ) : string | Content-type header | |
getFilename ( string $name, string $type, integer $index, array $content_range, string $tmp_name ) : string | Get filename for submitted filename | |
getFilesize ( string $path, boolean $clear_cache = false ) : float | Get size of file | |
getNewHeaders ( array $files, array $content_range ) : array | Generate headers for response | |
getSize ( ) : integer | Request size | |
process ( string $tmp_name, string $name, integer $size, string $type, integer $error, integer $index, array $content_range = null ) : FileUpload\File | Process single submitted file | |
processCallbacksFor ( string $eventName, FileUpload\File $file ) : void | Process callbacks for a given event | |
trimFilename ( string $name, string $type, integer $index, array $content_range ) : string | Remove harmful characters from filename | |
validate ( string $tmp_name, FileUpload\File $file, integer $error, integer $index ) : boolean | Validate upload using some default rules, and custom validators added via addValidator. Default rules: |
Method | Description | |
---|---|---|
prepareMessages ( ) | Converts $messages array into a hash with strings as keys This allows us to work with the keys and values as if it was a hash Which it really should be but, well, arrays in PHP, am I right? |
public __construct ( array $upload, array $server, FileUpload\FileNameGenerator\FileNameGenerator $generator = null ) | ||
$upload | array | |
$server | array | |
$generator | FileUpload\FileNameGenerator\FileNameGenerator |
public addCallback ( string $event, Closure $callback ) | ||
$event | string | |
$callback | Closure |
public addValidator ( FileUpload\Validator\Validator $v ) | ||
$v | FileUpload\Validator\Validator |
protected fixIntegerOverflow ( integer $int ) : float | ||
$int | integer | |
return | float |
protected getConfigBytes ( string $val ) : float | ||
$val | string | |
return | float |
protected getContentLength ( ) : integer | ||
return | integer |
protected getContentRange ( ) : array | ||
return | array |
protected getContentType ( ) : string | ||
return | string |
public getFileContainer ( ) : FileUpload\File | ||
return | FileUpload\File |
public getFileNameGenerator ( ) : FileUpload\FileNameGenerator\FileNameGenerator | ||
return | FileUpload\FileNameGenerator\FileNameGenerator |
public getFileSystem ( ) : FileUpload\FileSystem\FileSystem | ||
return | FileUpload\FileSystem\FileSystem |
public getLogger ( ) : Psr\Log\LoggerInterface | ||
return | Psr\Log\LoggerInterface |
public getMessage ( integer $code ) : string | ||
$code | integer | |
return | string |
public getPathResolver ( ) : FileUpload\PathResolver\PathResolver | ||
return | FileUpload\PathResolver\PathResolver |
public processAll ( ) : array | ||
return | array | Files and response headers |
protected processCallbacksFor ( string $eventName, FileUpload\File $file ) : void | ||
$eventName | string | |
$file | FileUpload\File | |
return | void |
public setFileNameGenerator ( FileUpload\FileNameGenerator\FileNameGenerator $fng ) | ||
$fng | FileUpload\FileNameGenerator\FileNameGenerator |
public setFileSystem ( FileUpload\FileSystem\FileSystem $fs ) | ||
$fs | FileUpload\FileSystem\FileSystem |
public setLogger ( Psr\Log\LoggerInterface $logger ) | ||
$logger | Psr\Log\LoggerInterface |
public setMessages ( array $new_messages ) | ||
$new_messages | array |
public setPathResolver ( FileUpload\PathResolver\PathResolver $pr ) | ||
$pr | FileUpload\PathResolver\PathResolver |
protected File,FileUpload $fileContainer | ||
return | FileUpload\File |
protected FileNameGenerator,FileUpload\FileNameGenerator $filename_generator | ||
return | FileUpload\FileNameGenerator\FileNameGenerator |
protected FileSystem,FileUpload\FileSystem $filesystem | ||
return | FileUpload\FileSystem\FileSystem |
protected LoggerInterface,Psr\Log $logger | ||
return | Psr\Log\LoggerInterface |
protected PathResolver,FileUpload\PathResolver $pathresolver | ||
return | FileUpload\PathResolver\PathResolver |