getName()])) { $value = $_FILES[$this->getName()]['tmp_name']; $context = $_FILES[$this->getName()]; $context['destination'] = $this->_destination; } $isValid = parent::isValid($value, $context); // If it's valid, we move the file to its final destination if ($isValid && isset($this->_destination)) { $destination = is_dir($this->_destination) ? $this->_destination . '/' . $context['name'] : $this->_destination; move_uploaded_file($value, $destination); } return $isValid; } /** * Get the upload destination * * @return string */ public function getDestination() { return $this->_destination; } /** * Set the upload destination * * @param string $path * @return Zend_Form_Element_File */ public function setDestination($destination) { $this->_destination = $destination; return $this; } }