/** * Trigger of type STARTER, make the file upload; * used in xml import; * @param object tNG transaction object * @param string name of the field from page * @return mix null or error object * @access private */ function Trigger_XMLImport_FileUpload(&$tNG, $formFieldName) { $ret = null; if ($tNG->isStarted()) { $uploadObj = new tNG_FileUpload($tNG); $uploadObj->setFormFieldName($formFieldName); $uploadObj->setDbFieldName(''); $uploadObj->setFolder(dirname(realpath(__FILE__)) . '/../../xml/tmp/'); $uploadObj->setMaxSize(10000); $uploadObj->setAllowedExtensions('xml'); $uploadObj->setRename("auto"); $ret = $uploadObj->Execute(); } else { $ret = null; } return $ret; }
/** * the main method, execute the code of the class; * Upload the file, set the file name in transaction; * return mix null or error object * @access public */ function Execute() { $ret = parent::Execute(); if ($ret === null && $this->resize && $this->uploadedFileName != '') { $ret = $this->Resize(); } return $ret; }