* @package tao */ class tao_helpers_form_data_UploadFileDescription extends tao_helpers_form_data_FileDescription { /** Action form: add */ const FORM_ACTION_ADD = 'add'; /** Action form: delete */ const FORM_ACTION_DELETE = 'delete'; /** * The mime/type of the file e.g. text/plain. * * @access private * @var string */ private $type = ''; /** * The temporary file path where the file is uploaded, waiting to be moved * the right place on the file system. * * @access private * @var \oat\oatbox\filesystem\File */ private $tmpPath; /** * Allow to specify action to know form purpose * * @var string */ private $action; /** * The temporary file path where the file is stored before being moved to * right place. * * @access public * @author Jerome Bogaerts * @param string $name The name of the file e.g. tmpImage.tmp * @param int $size The size of the file in bytes * @param string $type The mime-type of the file e.g. text/plain. * @param string $tmpPath * @param string $action * @return mixed * @throws \oat\oatbox\service\ServiceNotFoundException * @throws \common_Exception */ public function __construct($name, $size, $type, $tmpPath, $action = null) { parent::__construct($name, $size); $this->type = $type; if ($tmpPath) { $this->tmpPath = ServiceManager::getServiceManager()->get(UploadService::SERVICE_ID)->universalizeUpload($tmpPath); } $this->action = is_null($action) ? self::FORM_ACTION_ADD : $action; } /** * Returns the mime-type of the file. * * @access public * @author Jerome Bogaerts * @return string */ public function getType() { return (string) $this->type; } /** * Returns the temporary path of the file. * * @access public * @author Jerome Bogaerts * @return \oat\oatbox\filesystem\File */ public function getTmpPath() { return $this->tmpPath; } /** * Return action form * * @return string */ public function getAction() { return $this->action; } }