equal
deleted
inserted
replaced
12 * obtain it through the world-wide-web, please send an email |
12 * obtain it through the world-wide-web, please send an email |
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Validate |
16 * @package Zend_Validate |
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
17 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @version $Id: Upload.php 24959 2012-06-15 13:51:04Z adamlundrigan $ |
19 * @version $Id$ |
20 */ |
20 */ |
21 |
21 |
22 /** |
22 /** |
23 * @see Zend_Validate_Abstract |
23 * @see Zend_Validate_Abstract |
24 */ |
24 */ |
27 /** |
27 /** |
28 * Validator for the maximum size of a file up to a max of 2GB |
28 * Validator for the maximum size of a file up to a max of 2GB |
29 * |
29 * |
30 * @category Zend |
30 * @category Zend |
31 * @package Zend_Validate |
31 * @package Zend_Validate |
32 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
32 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
33 * @license http://framework.zend.com/license/new-bsd New BSD License |
33 * @license http://framework.zend.com/license/new-bsd New BSD License |
34 */ |
34 */ |
35 class Zend_Validate_File_Upload extends Zend_Validate_Abstract |
35 class Zend_Validate_File_Upload extends Zend_Validate_Abstract |
36 { |
36 { |
37 /**@#+ |
37 /**@#+ |
76 * |
76 * |
77 * The array $files must be given in syntax of Zend_File_Transfer to be checked |
77 * The array $files must be given in syntax of Zend_File_Transfer to be checked |
78 * If no files are given the $_FILES array will be used automatically. |
78 * If no files are given the $_FILES array will be used automatically. |
79 * NOTE: This validator will only work with HTTP POST uploads! |
79 * NOTE: This validator will only work with HTTP POST uploads! |
80 * |
80 * |
81 * @param array|Zend_Config $files Array of files in syntax of Zend_File_Transfer |
81 * @param array|Zend_Config $files Array of files in syntax of Zend_File_Transfer |
82 * @return void |
|
83 */ |
82 */ |
84 public function __construct($files = array()) |
83 public function __construct($files = array()) |
85 { |
84 { |
86 if ($files instanceof Zend_Config) { |
85 if ($files instanceof Zend_Config) { |
87 $files = $files->toArray(); |
86 $files = $files->toArray(); |
91 } |
90 } |
92 |
91 |
93 /** |
92 /** |
94 * Returns the array of set files |
93 * Returns the array of set files |
95 * |
94 * |
96 * @param string $files (Optional) The file to return in detail |
95 * @param string $file (Optional) The file to return in detail |
97 * @return array |
96 * @return array |
98 * @throws Zend_Validate_Exception If file is not found |
97 * @throws Zend_Validate_Exception If file is not found |
99 */ |
98 */ |
100 public function getFiles($file = null) |
99 public function getFiles($file = null) |
101 { |
100 { |
155 * |
154 * |
156 * Returns true if and only if the file was uploaded without errors |
155 * Returns true if and only if the file was uploaded without errors |
157 * |
156 * |
158 * @param string $value Single file to check for upload errors, when giving null the $_FILES array |
157 * @param string $value Single file to check for upload errors, when giving null the $_FILES array |
159 * from initialization will be used |
158 * from initialization will be used |
|
159 * @param string|null $file |
160 * @return boolean |
160 * @return boolean |
161 */ |
161 */ |
162 public function isValid($value, $file = null) |
162 public function isValid($value, $file = null) |
163 { |
163 { |
164 $this->_messages = null; |
164 $this->_messages = null; |