Property | Type | Description | |
---|---|---|---|
$autoconfirm | boolean | Whether or not the uploaded files are auto confirmed | |
$container | Sirius\Upload\Container\ContainerInterface | ||
$overwrite | boolean | When uploading a file that has the same name as a file that is already in the container should it overwrite it or use another name | |
$prefix | string | callback | It can be a subfolder (if it ends with '/', a string to be used as prefix) or a callback that returns a string | |
$sanitizerCallback | function | callback | ||
$validator | Sirius\Validation\ValueValidator |
Method | Description | |
---|---|---|
__construct ( $directoryOrContainer, array $options = [], Sirius\Validation\ValueValidator $validator = null ) | ||
addRule ( string $name, mixed $options = null, string $errorMessageTemplate = null, string $label = null ) : |
Add validation rule (extension|size|width|height|ratio) | |
process ( array $files = [] ) : Sirius\Upload\Result\Collection | Sirius\Upload\Result\File | Processes a file upload and returns an upload result file/collection | |
setAutoconfirm ( boolean $autoconfirm ) : |
Enable/disable upload autoconfirmation Autoconfirmation does not require calling confirm() | |
setOverwrite ( boolean $overwrite ) : |
Enable/disable upload overwrite | |
setPrefix ( string | callable $prefix ) : |
File prefix for the upload. Can be - a folder (if it ends with /) - a string to be used as prefix - a function that returns a string | |
setSanitizerCallback ( callable $callback ) : |
Set the sanitizer function for cleaning up the file names |
Method | Description | |
---|---|---|
processSingleFile ( array $file ) : array | Processes a single uploaded file - sanitize the name - validates the file - if valid, moves the file to the container | |
sanitizeFileName ( string $name ) : string | Sanitize the name of the uploaded file by stripping away bad characters and replacing "invalid" characters with underscore _ | |
validateFile ( $file ) : mixed | Validates a file according to the rules configured on the handler |
public __construct ( $directoryOrContainer, array $options = [], Sirius\Validation\ValueValidator $validator = null ) | ||
$directoryOrContainer | ||
$options | array | |
$validator | Sirius\Validation\ValueValidator |
protected processSingleFile ( array $file ) : array | ||
$file | array | |
return | array |
protected sanitizeFileName ( string $name ) : string | ||
$name | string | |
return | string |
public setAutoconfirm ( boolean $autoconfirm ) : |
||
$autoconfirm | boolean | |
return |
public setOverwrite ( boolean $overwrite ) : |
||
$overwrite | boolean | |
return |
public setSanitizerCallback ( callable $callback ) : |
||
$callback | callable | |
return |
protected validateFile ( $file ) : mixed | ||
$file | ||
return | mixed |
protected bool $autoconfirm | ||
return | boolean |
protected ContainerInterface,Sirius\Upload\Container $container | ||
return | Sirius\Upload\Container\ContainerInterface |
protected bool $overwrite | ||
return | boolean |
protected function|callback $sanitizerCallback | ||
return | function | callback |