25 #require_once 'Zend/Validate/Abstract.php'; 48 self::TOO_MANY =>
"Too many files, maximum '%max%' are allowed but '%count%' are given",
49 self::TOO_FEW =>
"Too few files, minimum '%min%' are expected but '%count%' are given",
113 #require_once 'Zend/Validate/Exception.php'; 117 if (1 < func_num_args()) {
150 if (is_array($min) and isset($min[
'min'])) {
154 if (!is_string($min) and !is_numeric($min)) {
155 #require_once 'Zend/Validate/Exception.php'; 159 $min = (integer) $min;
160 if (($this->_max !==
null) && ($min >
$this->_max)) {
161 #require_once 'Zend/Validate/Exception.php'; 162 throw new Zend_Validate_Exception(
"The minimum must be less than or equal to the maximum file count, but $min >" 189 if (is_array($max) and isset($max[
'max'])) {
193 if (!is_string($max) and !is_numeric($max)) {
194 #require_once 'Zend/Validate/Exception.php'; 198 $max = (integer) $max;
199 if (($this->_min !==
null) && ($max <
$this->_min)) {
200 #require_once 'Zend/Validate/Exception.php'; 202 .
"$max < {$this->_min}");
217 if (is_string($file)) {
218 $file = array($file);
221 if (is_array($file)) {
222 foreach ($file as
$name) {
223 if (!isset($this->_files[
$name]) && !empty(
$name)) {
245 if (($file !==
null) && !array_key_exists(
'destination', $file)) {
246 $file[
'destination'] = dirname(
$value);
249 if (($file !==
null) && array_key_exists(
'tmp_name', $file)) {
250 $value = $file[
'destination'] . DIRECTORY_SEPARATOR . $file[
'name'];
253 if (($file ===
null) || !empty($file[
'tmp_name'])) {
257 $this->_count = count($this->_files);
258 if (($this->_max !==
null) && ($this->_count > $this->_max)) {
259 return $this->
_throw($file, self::TOO_MANY);
262 if (($this->_min !==
null) && ($this->_count < $this->_min)) {
263 return $this->
_throw($file, self::TOO_FEW);
276 protected function _throw($file, $errorType)
278 if ($file !==
null) {
279 $this->_value = $file[
'name'];
282 $this->
_error($errorType);
_throw($file, $errorType)
elseif(isset( $params[ 'redirect_parent']))
isValid($value, $file=null)
_error($messageKey, $value=null)
if(!isset($_GET['name'])) $name