diff options
| -rwxr-xr-x | framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js | 9 | ||||
| -rwxr-xr-x | framework/Web/UI/ActiveControls/TActiveFileUpload.php | 12 | 
2 files changed, 19 insertions, 2 deletions
| diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js index 7a1e0e77..251a3d35 100755 --- a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js +++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js @@ -14,6 +14,13 @@ Prado.WebUI.TActiveFileUpload = Base.extend(  		this.error = $(options.errorID);  		Prado.Registry.set(options.inputID, this); + +		var tempfield = document.createElement('input'); +		tempfield.id = "tempActiveUploadField"; +		tempfield.name = "tempActiveUploadField"; +		tempfield.value = this.options.targetID; +		tempfield.type = "hidden"; +		this.form.appendChild(tempfield);  		// set up events  		if (options.autoPostBack){ @@ -27,7 +34,7 @@ Prado.WebUI.TActiveFileUpload = Base.extend(  		this.complete.style.display = 'none';  		this.error.style.display = 'none';  		this.indicator.style.display = ''; -		 +  		// set the form to submit in the iframe, submit it, and then reset it.  		this.oldtargetID = this.form.target;  		this.form.target = this.options.targetID; diff --git a/framework/Web/UI/ActiveControls/TActiveFileUpload.php b/framework/Web/UI/ActiveControls/TActiveFileUpload.php index b935936b..3b8212b9 100755 --- a/framework/Web/UI/ActiveControls/TActiveFileUpload.php +++ b/framework/Web/UI/ActiveControls/TActiveFileUpload.php @@ -96,7 +96,7 @@ class TActiveFileUpload extends TFileUpload implements IActiveControl, ICallback  	 * @param TEventParameter event parameter to be passed to the event handlers  	 */  	public function onFileUpload($param){ -		if ($this->_flag->getValue() && $this->getPage()->getIsPostBack()){ +		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); @@ -191,6 +191,16 @@ EOS;  	}  	/** +	 * Raises postdata changed event. +	 * This method calls {@link onFileUpload} method +	 * This method is primarily used by framework developers. +	 */ +	public function raisePostDataChangedEvent() +	{ +		$this->onFileUpload($this->getPage()->getRequest()->itemAt('tempActiveUploadField')); +	} + +	/**  	 * Publish the javascript  	 */  	public function onPreRender($param){ | 
