extends abstract class Phalcon\Validation\Validator
implements Phalcon\Validation\ValidatorInterface
Checks if a value has a correct file
use Phalcon\Validation\Validator\File as FileValidator; $validator->add('file', new FileValidator([ 'maxSize' => '2M', 'messageSize' => ':field exceeds the max filesize (:max)', 'allowedTypes' => array('image/jpeg', 'image/png'), 'messageType' => 'Allowed file types are :types', 'maxResolution' => '800x600', 'messageMaxResolution' => 'Max resolution of :field is :max' ])); $validator->add(['file', 'anotherFile'], new FileValidator([ 'maxSize' => [ 'file' => '2M', 'anotherFile' => '4M' ], 'messageSize' => [ 'file' => 'file exceeds the max filesize 2M', 'anotherFile' => 'anotherFile exceeds the max filesize 4M', 'allowedTypes' => [ 'file' => ['image/jpeg', 'image/png'], 'anotherFile' => ['image/gif', 'image/bmp'] ], 'messageType' => [ 'file' => 'Allowed file types are image/jpeg and image/png', 'anotherFile' => 'Allowed file types are image/gif and image/bmp' ], 'maxResolution' => [ 'file' => '800x600', 'anotherFile' => '1024x768' ], 'messageMaxResolution' => [ 'file' => 'Max resolution of file is 800x600', 'anotherFile' => 'Max resolution of file is 1024x768' ] ]));
Executes the validation
Check on empty
Phalcon\Validation\Validator constructor
Checks if an option has been defined
Checks if an option is defined
Returns an option in the validator’s options Returns null if the option hasn’t set
Sets an option in the validator
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Validation_Validator_File.html