/** * This method is invoked when a file is uploaded. * If you override this method, be sure to call the parent implementation to ensure * the invocation of the attached event handlers. * @param TEventParameter event parameter to be passed to the event handlers */ public function onFileUpload($param) { if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()) { // save the file so that it will persist past the end of this return. $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), '')); parent::saveAs($localName); $this->_localName = $localName; $params = new TActiveFileUploadCallbackParams(); $params->localName = $localName; $params->fileName = addslashes($this->getFileName()); $params->fileSize = $this->getFileSize(); $params->fileType = $this->getFileType(); $params->errorCode = $this->getErrorCode(); // return some javascript to display a completion status. echo <<<EOS <script language="Javascript"> \tOptions = new Object(); \tOptions.clientID = '{$this->getClientID()}'; \tOptions.targetID = '{$this->_target->getUniqueID()}'; \tOptions.fileName = '{$params->fileName}'; \tOptions.fileSize = '{$params->fileSize}'; \tOptions.fileType = '{$params->fileType}'; \tOptions.errorCode = '{$params->errorCode}'; \tOptions.callbackToken = '{$this->pushParamsAndGetToken($params)}'; \tparent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options); </script> EOS; exit; } }