From 628c6ec94c81935d9906640829635737276244d7 Mon Sep 17 00:00:00 2001 From: rojaro <> Date: Sun, 1 Nov 2009 21:10:37 +0000 Subject: merged fix for proper errorhandling when the size of the uploaded file exceeds the limit see http://www.pradosoft.com/forum/index.php?topic=11850.0 --- .../Web/UI/ActiveControls/TActiveFileUpload.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'framework/Web/UI') diff --git a/framework/Web/UI/ActiveControls/TActiveFileUpload.php b/framework/Web/UI/ActiveControls/TActiveFileUpload.php index 3b8212b9..eb92615a 100755 --- a/framework/Web/UI/ActiveControls/TActiveFileUpload.php +++ b/framework/Web/UI/ActiveControls/TActiveFileUpload.php @@ -207,9 +207,28 @@ EOS; parent::onPreRender($param); $this->getPage()->getClientScript()->registerPradoScript('effects'); $this->getPage()->getClientScript()->registerPradoScript('activefileupload'); + + if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID()) + { + $this->_errorCode = UPLOAD_ERR_FORM_SIZE; + $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); + $filename = addslashes($this->getFileName()); + echo << + Options = new Object(); + Options.clientID = '{$_GET['TActiveFileUpload_InputId']}'; + Options.targetID = '{$_GET['TActiveFileUpload_TargetId']}'; + Options.localName = '{$localName}'; + Options.fileName = '{$fileName}'; + Options.fileSize = '{$this->getFileSize()}'; + Options.fileType = '{$this->getFileType()}'; + Options.errorCode = '{$this->getErrorCode()}'; + parent.Prado.WebUI.TactiveFileUpload.onFileUpload(Options); + +EOS; + } } - public function createChildControls(){ $this->_flag = Prado::createComponent('THiddenField'); $this->_flag->setID('Flag'); -- cgit v1.2.3