summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrojaro <>2009-11-01 21:10:37 +0000
committerrojaro <>2009-11-01 21:10:37 +0000
commit628c6ec94c81935d9906640829635737276244d7 (patch)
treef55b93c022f92949d5b01ef739345552544e7c17
parentb904a24660f4a4dc5ad73a1cbb9ca6b80314f694 (diff)
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
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/activefileupload.js3
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveFileUpload.php21
2 files changed, 23 insertions, 1 deletions
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
index 251a3d35..f42a0673 100755
--- a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
+++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
@@ -37,8 +37,11 @@ Prado.WebUI.TActiveFileUpload = Base.extend(
// set the form to submit in the iframe, submit it, and then reset it.
this.oldtargetID = this.form.target;
+ this.oldFormAction = this.form.action;
+ this.form.action += '?TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_TargetId='+this.options.targetID;
this.form.target = this.options.targetID;
this.form.submit();
+ this.form.action = this.oldFormAction;
this.form.target = this.oldtargetID;
},
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 <<<EOS
+<script language="Javascript">
+ 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);
+</script>
+EOS;
+ }
}
-
public function createChildControls(){
$this->_flag = Prado::createComponent('THiddenField');
$this->_flag->setID('Flag');