/** * Is field valid * * @return \FormHandler\Field\FileBasic * @author Marien den Besten */ public function processValidators() { $this->setErrorState(false); // when no file field was submitted (on multi-paged forms) if (!isset($_FILES[$this->name])) { return $this; } // is a own error handler used? if (count($this->validators) != 0) { parent::processValidators(); return $this; } // easy name to work with (this is the $_FILES['xxx'] array ) $file = $this->value; if ($this->getRequired() === true && (!is_array($file) || trim($file['name']) == '')) { //no file uploaded $this->setErrorMessage(\FormHandler\Language::get(22)); $this->setErrorState(true); } return $this; }