示例#1
0
 /**
  * Checks if the files are valid
  *
  * @param  string|array $files (Optional) Files to check
  * @return boolean True if all checks are valid
  */
 public function isValid($files = null)
 {
     // Workaround for WebServer not conforming HTTP and omitting CONTENT_LENGTH
     $content = 0;
     if (isset($_SERVER['CONTENT_LENGTH'])) {
         $content = $_SERVER['CONTENT_LENGTH'];
     } else {
         if (!empty($_POST)) {
             $content = serialize($_POST);
         }
     }
     // Workaround for a PHP error returning empty $_FILES when form data exceeds php settings
     if (empty($this->_files) && $content > 0) {
         if (is_array($files)) {
             $files = current($files);
         }
         $temp = array($files => array('name' => $files, 'error' => 1));
         $validator = $this->_validators['Zend\\Validator\\File\\Upload'];
         $validator->setFiles($temp)->isValid($files, null);
         $this->_messages += $validator->getMessages();
         return false;
     }
     return parent::isValid($files);
 }