Documentation

UploadFile — Zend Framework 2 2.1.5 documentation

UploadFile

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
}

Select a version:
Select chapter:

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts