Zend\Validator\File\UploadFile checks whether a single file has been uploaded via a form POST and will return descriptive messages for any upload errors.
Note
Zend\InputFilter\FileInput will automatically prepend this validator in it’s validation chain.
Usage Examples
1 2 3 4 5 6 7 8 9 10 | use Zend\Http\PhpEnvironment\Request;
$request = new Request();
$files = $request->getFiles();
// i.e. $files['my-upload']['error'] == 0
$validator = \Zend\Validator\File\UploadFile();
if ($validator->isValid($files['my-upload'])) {
// file is valid
}
|
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.