Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Rucht  
#1 Posted : Sunday, August 3, 2008 9:05:11 PM(UTC)
Rucht

Rank: Newbie

Groups: Member
Joined: 7/18/2008(UTC)
Posts: 6

Hello

my image uploader work well on FireFox and Opera but on IE when I click on the add buton IE freeze -> not responding

there is my iuembed.js

Code:
// Aurigma Image Uploader Dual 5.x Embedding Script 
// Version 2.0.4.0 Feb 20, 2008
// Copyright(c) Aurigma Inc. 2002-2008

function __Browser(){
	var a=navigator.userAgent.toLowerCase();
	this.isOpera=(a.indexOf("opera")!=-1);
	this.isKonq=(a.indexOf('konqueror')!=-1);
	this.isSafari=(a.indexOf('safari')!=-1)&&(a.indexOf('mac')!=-1);
	this.isKhtml=this.isSafari||this.isKonq;
	this.isIE=(a.indexOf("msie")!=-1)&&!this.isOpera;
	this.isWinIE=this.isIE;
	this.isCSS1Compat=(!this.isIE)||(document.compatMode&&document.compatMode=="CSS1Compat");
}

var __browser=new __Browser();

//Create set/get expando methods for ActiveX
function _createExpandoMethods(id){
	var o=document.getElementById(id);
	var props=new Array();
	var hasPaneItemApiElements=false;
	for (propName in o){
		var c=propName.charAt(0);
		if (c==c.toUpperCase()){
			props.push(propName);
			if (propName=="PaneItemDesign"){
				hasPaneItemApiElements=true;
			}
		}
	}
	for (i=0;i<props.length;i++){
		//Check whether property is indexed
		if (typeof(o[props[i]])=="unknown"){
			eval("o.set"+props[i]+"=function(i,v){this."+props[i]+"(i)=v;};");
			eval("o.get"+props[i]+"=function(i){return this."+props[i]+"(i);};");
		}
		else{
			eval("o.set"+props[i]+"=function(v){this."+props[i]+"=v};");
			eval("o.get"+props[i]+"=function(){return this."+props[i]+"};");
		}
	}
	if (hasPaneItemApiElements){
		eval("o.setPaneItemDesign = function(Pane, Index, Value){this.PaneItemDesign(Pane, Index) = Value;};");
		eval("o.getPaneItemDesign = function(Pane, Index){return this.PaneItemDesign(Pane, Index);};");		
		//eval("o.getPaneItemCount = function(Pane){return this.PaneItemCount(Pane);};");
		//eval("o.getPaneItemChecked = function(Index){return this.PaneItemChecked(Index);};");
		//eval("o.getPaneItemCanBeUploaded = function(Index){return this.PaneItemCanBeUploaded(Index);};");
		eval("o.getPaneItemSelected = function(Pane, Index){return this.PaneItemSelected(Pane, Index);};");
		eval("o.setPaneItemEnabled = function(Pane, Index, Value){this.PaneItemEnabled(Pane, Index) = Value;};");
		eval("o.getPaneItemEnabled = function(Pane, Index){return this.PaneItemEnabled(Pane, Index);};");
	}
}

//Installation instructions
function _addInstructions(obj){
	obj.instructionsEnabled=true;
	if (obj.controlClass=="FileDownloader"){
		obj.instructionsCommon="<p>File Downloader ActiveX control is necessary to download "+
			"files quickly and easily. You will be able to select required files "+
			"in a user-friendly interface and simply click a <strong>Download</strong> button. "+
			"Installation will take up to few minutes, please be patient. To install File Downloader, ";
		obj.instructionsNotWinXPSP2="please reload the page and click the <strong>Yes</strong> button " +
			"when you see the control installation dialog.";
		obj.instructionsWinXPSP2="please click the <strong>Information Bar</strong>. After page reload click <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsVista = "please click on the <strong>Information Bar</strong> and select <strong>Install ActiveX Control</strong> "+
			"from the dropdown menu. After page reload click <strong>Continue</strong> and then <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsCommon2="</p><p><strong>NOTE:</strong> If control fails to be installed, it may mean that it has been inserted to the page incorrectly. "+
			"Refer File Downloader documentation for more details.</p>";
	} else {
		obj.instructionsCommon="<p>Image Uploader ActiveX control is necessary to upload "+
			"your files quickly and easily. You will be able to select multiple images "+
			"in user-friendly interface instead of clumsy input fields with <strong>Browse</strong> button. "+
			"Installation will take up to few minutes, please be patient. To install Image Uploader, ";
		obj.instructionsNotWinXPSP2="please reload the page and click the <strong>Yes</strong> button " +
			"when you see the control installation dialog.";
		obj.instructionsWinXPSP2="please click on the <strong>Information Bar</strong> and select " +
			"<strong>Install ActiveX Control</strong> from the dropdown menu. After page reload click <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsVista = "please click on the <strong>Information Bar</strong> and select <strong>Install ActiveX Control</strong> "+
			"from the dropdown menu. After page reload click <strong>Continue</strong> and then <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsCommon2="</p>";
	}
}

function ControlWriter(id,width,height){
	//Private
	this._params=new Array();
	this._events=new Array();
	
	_addInstructions(this);

	this._getObjectParamHtml=function(name,value){
		return "<param name=\""+name+"\" value=\""+value+"\" />";
	}

	this._getObjectParamsHtml=function(){
		var r="";
		var p=this._params;
		var i;
		for (i=0;i<p.length;i++){
			r+=this._getObjectParamHtml(p[i].name,p[i].value);
		}
		return r;
	}

	this._getObjectEventsHtml=function(){
		var r="";
		var e=this._events;
		for (i=0;i<e.length;i++){
			r+=this._getObjectParamHtml(e[i].name+"Listener",e[i].listener);
		}
		return r;
	}

	this._getEmbedParamHtml=function(name,value){
		return " "+name+"=\""+value+"\"";	
	}

	this._getEmbedParamsHtml=function(){
		var r="";
		var p=this._params;
		var i;
		for (i=0;i<p.length;i++){
			r+=this._getEmbedParamHtml(p[i].name,p[i].value);
		}
		return r;
	}

	this._getEmbedEventsHtml=function(){
		var r="";
		var e=this._events;
		for (i=0;i<e.length;i++){
			r+=this._getEmbedParamHtml(e[i].name+"Listener",e[i].listener);
		}
		return r;
	}

	//Public

	//Properties
	this.id=id;
	this.width=width;
	this.height=height;

	this.activeXControlEnabled=false; // modif
	this.activeXControlVersion="";

	this.javaAppletEnabled=true;
	this.javaAppletCodeBase="./";
	this.javaAppletCached=true;
	this.javaAppletVersion="";

	this.fullPageLoadListenerName=null;

	//Methods
	this.addParam=function(paramName,paramValue){
		var p=new Object();
		p.name=paramName;
		p.value=paramValue;
		this._params.push(p);
	}

	this.addEventListener=function(eventName,eventListener){
		try
	        {
        	    	eval("var checkListener = " + eventListener + ";");
	            	if (checkListener == null)
			{
				return;
        		}
	        }
        	catch (e)
	        {
        	    	return;
	        }
		var p=new Object();
		p.name=eventName;
		p.listener=eventListener;
		this._events.push(p);
	}

	this.getActiveXInstalled=function(){
		if (this.activeXProgId){
			try{
				var a=new ActiveXObject(this.activeXProgId);
				return true;
			}
			catch(e){
				return false;
			}
		}
		return false;
	}

	this.getHtml=function(){
		var r="";
		if (this.fullPageLoadListenerName){
			r+="<" + "script type=\"text/javascript\">";
			r+="var __"+this.id+"_pageLoaded=false;";
			r+="var __"+this.id+"_controlLoaded=false;";
			r+="function __fire_"+this.id+"_fullPageLoad(){";
			r+="if (__"+this.id+"_pageLoaded&&__"+this.id+"_controlLoaded){";
			r+=this.fullPageLoadListenerName + "();";
			r+="}";
			r+="}";
			var pageLoadCode="new Function(\"__"+this.id+"_pageLoaded=true;__fire_"+this.id+"_fullPageLoad();\")";
			if (__browser.isWinIE){
				r+="window.attachEvent(\"onload\","+pageLoadCode+");";
			}
			else{
				r+="var r=window.addEventListener?window:document.addEventListener?document:null;";
				r+="if (r){r.addEventListener(\"load\","+pageLoadCode+",false);}";
			}
			r+="<"+"/script>";
		}		

		//ActiveX control
/*		if(__browser.isWinIE&&this.activeXControlEnabled){
			var v=this.activeXControlVersion.replace(/\./g,",")
			var cb=this.activeXControlCodeBase+(v==""?"":"#version="+v);

			r+="<" + "script for=\""+this.id+"\" event=\"InitComplete()\">";
			r+="_createExpandoMethods(\""+this.id+"\");";
			if (this.fullPageLoadListenerName){
				r+="__"+this.id+"_controlLoaded=true;";
				r+="__fire_"+this.id+"_fullPageLoad();";
			}
			r+="<"+"/script>";

			r+="<object id=\""+this.id+"\" name=\""+this.id+"\" classid=\"clsid:"+this.activeXClassId+"\" codebase=\""+cb+"\" width=\""+this.width+"\" height=\""+this.height+"\">";
			if (this.instructionsEnabled){
				r+=this.instructionsCommon;
				var isXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1) || (window.navigator.userAgent.indexOf("MSIE 7.0") != -1);
				var isVista = (window.navigator.userAgent.indexOf("Windows NT 6.0") != -1) && (window.navigator.userAgent.indexOf("MSIE 7.0") != -1);
				if (isVista) {
					r+=this.instructionsVista;
					//r+=this.instructionsWinXPSP2;
				} else if (isXPSP2) {
					r+=this.instructionsWinXPSP2;
				}
				else{
					r+=this.instructionsNotWinXPSP2;
				}
				r+=this.instructionsCommon2;
			}
			r+=this._getObjectParamsHtml();
			r+="</object>";

			//Event handlers
			var e=this._events;
			var eventParams;
			for (i=0;i<e.length;i++){
				if (this.controlClass=="FileDownloader"){
					switch (e[i].name){
						case "DownloadComplete":
							eventParams="Value";
							break;
						case "DownloadItemComplete":
							eventParams="Result, ErrorPage, Url, FileName, ContentType, FileSize";
							break;
						case "DownloadStep":
							eventParams="Step";
							break;
						case "Progress":
							eventParams="PercentTotal, PercentCurrent, Index";
							break;
						case "Error":
							eventParams="ErrorCode, HttpErrorCode, ErrorPage, Url, Index";
							break;
						default:
							eventParams="";
					}
					r+="<script for=\""+this.id+"\" event=\""+e[i].name+"("+eventParams+")\">";
					r+=e[i].listener+"("+eventParams+");";
					r+="<"+"/script>";
				}
				else {
					switch (e[i].name){
						case "Progress":
							eventParams="Status, Progress, ValueMax, Value, StatusText";
							break;
						case "InnerComplete":
							eventParams="Status, StatusText";
							break;
						case "AfterUpload":
							eventParams="htmlPage";
							break;
						case "ViewChange":
						case "SortModeChange":
							eventParams="Pane";
							break;
						case "Error":
							eventParams="ErrorCode, HttpResponseCode, ErrorPage, AdditionalInfo";
							break;
						case "PackageBeforeUpload":
							eventParams = "PackageIndex";
						    	break;
					//	case "PackageError":
				//		    	eventParams = "PackageIndex, ErrorCode, HttpResponseCode, ErrorPage, AdditionalInfo";
			//			    	break;
		//				case "PackageComplete":
	//					    	eventParams = "PackageIndex, ResponsePage";
//						    	break;
					//	case "PackageProgress":
				//		    	eventParams = "PackageIndex, Status, Progress, ValueMax, Value, StatusText";
			//			    	break;
		//				default:
	//						eventParams="";
//					}
				//}
			//	r+="<" + "script for=\""+this.id+"\" event=\""+e[i].name+"("+eventParams+")\">";
		//		if (e[i].name=="BeforeUpload"){
	//				r+="return ";
//				}
			//	r+=e[i].listener+"("+eventParams+");";
		//		r+="<"+"/script>";
	//		}
//
//		}
		else */
		//Java appplet
		if(this.javaAppletEnabled){
			if (this.fullPageLoadListenerName){
				r+="<" + "script type=\"text/javascript\">";
				r+="function __"+this.id+"_InitComplete(){";
				r+="__"+this.id+"_controlLoaded=true;";
				r+="__fire_"+this.id+"_fullPageLoad();";
				r+="}";
				r+="<"+"/script>";
			}

			//<object> for IE and <applet> for Safari
			if (__browser.isWinIE||__browser.isKhtml){
				if (__browser.isWinIE){
					r+="<object id=\""+this.id+"\" classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\" codebase=\""+window.location.protocol+"//java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0\" width=\""+this.width+"\" height=\""+this.height+"\">";
				}
				else{
					r+="<applet id=\""+this.id+"\" code=\""+this.javaAppletClassName+"\" java_codebase=\"../\" align=\"baseline\" archive=\""+this.javaAppletJarFileName+"\" mayscript=\"true\" scriptable=\"true\" width=\""+this.width+"\" height=\""+this.height+"\">";
				}

				if (this.javaAppletCached&&this.javaAppletVersion!=""){
					r+=this._getObjectParamHtml("cache_archive",this.javaAppletJarFileName);
					var v=this.javaAppletVersion.replace(/\,/g,".");
					//r+=this._getObjectParamHtml("cache_version",v+","+v);
					r+=this._getObjectParamHtml("cache_version",v);
				}

				r+=this._getObjectParamHtml("type","application/x-java-applet;version=1.4");
				r+=this._getObjectParamHtml("codebase",this.javaAppletCodeBase);
				r+=this._getObjectParamHtml("archive",this.javaAppletJarFileName);
				r+=this._getObjectParamHtml("code",this.javaAppletClassName);
				r+=this._getObjectParamHtml("scriptable","true");
				r+=this._getObjectParamHtml("mayscript","true");

				r+=this._getObjectParamsHtml();

				r+=this._getObjectEventsHtml();

				if (this.fullPageLoadListenerName){
					r+=this._getObjectParamHtml("InitCompleteListener","__"+this.id+"_InitComplete");
				}
				if (__browser.isWinIE){
					r+="</object>";
				}
				else{
					r+="</applet>";
				}
			}
			//<embed> for all other browsers
			else{
				r+="<embed id=\""+this.id+"\" type=\"application/x-java-applet;version=1.4\" codebase=\""+this.javaAppletCodeBase+"\" code=\""+this.javaAppletClassName+"\" archive=\""+this.javaAppletJarFileName+"\" width=\""+this.width+"\" height=\""+this.height+"\" scriptable=\"true\" mayscript=\"true\" pluginspage=\""+window.location.protocol+"//java.sun.com/products/plugin/index.html#download\"";

				if (this.javaAppletCached&&this.javaAppletVersion!=""){
					r+=this._getEmbedParamHtml("cache_archive",this.javaAppletJarFileName);
					var v=this.javaAppletVersion.replace(/\,/g,".");
					//r+=this._getEmbedParamHtml("cache_version",v+","+v);
					r+=this._getEmbedParamHtml("cache_version",v);
				}

				r+=this._getEmbedParamsHtml();

				r+=this._getEmbedEventsHtml();

				if (this.fullPageLoadListenerName){
					r+=this._getEmbedParamHtml("InitCompleteListener","__"+this.id+"_InitComplete");
				}
				r+=">";
				r+="</embed>";
			}
		}
		else
		{
			r+="Your browser is not supported.";
		}
		
		//For backward compatibility
		this.controlType=this.getControlType();
			
		return r;
	}

	this.getControlType=function(){
		return (__browser.isWinIE&&this.activeXControlEnabled)?"ActiveX":(this.javaAppletEnabled?"Java":"None");
	}
	
	this.writeHtml=function(){
		document.write(this.getHtml());
	}
}

function ImageUploaderWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private-label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="BA162249-F2C5-4851-8ADC-FC58CB424243";
	this.activeXClassId="5D637FAD-E202-48D1-8F18-5B9C459BD1E3";
	this.activeXProgId="Aurigma.ImageUploaderEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.ImageUploader.class";

	//Extend
	this.showNonemptyResponse="off";
	this._getHtml=this.getHtml;
	this.getHtml=function(){
		var r="";
		if (this.showNonemptyResponse!="off"){
			r+="<" + "script type=\"text/javascript\">";
			r+="function __"+this.id+"_InnerComplete(Status,StatusText){";
			r+="if (new String(Status)==\"COMPLETE\" && new String(StatusText).replace(/\\s*/g,\"\")!=\"\"){";
			if (this.showNonemptyResponse=="dump"){
				r+="var f=document.createElement(\"fieldset\");";
				r+="var l=f.appendChild(document.createElement(\"legend\"));";
				r+="l.appendChild(document.createTextNode(\"Server Response\"));";
				r+="var d=f.appendChild(document.createElement(\"div\"));";
				r+="d.innerHTML=StatusText;";
				r+="var b=f.appendChild(document.createElement(\"button\"));";
				r+="b.appendChild(document.createTextNode(\"Clear Server Response\"));";
				r+="b.onclick=function(){var f=this.parentNode;f.parentNode.removeChild(f)};";
				r+="document.body.appendChild(f);";
			}
			else{
				var s="";
				for (var i=0;i<80;i++){s+="-";}
				r+="alert(\""+s+"\\r\\nServer Response\\r\\n"+s+"\\r\\n\"+StatusText);";
			}
			r+="}";
			r+="}";
			r+="<"+"/script>";
			this.addEventListener("InnerComplete","__"+this.id+"_InnerComplete");
		}
		return r+this._getHtml();
	}
}

function ThumbnailWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="27BE1679-6AEE-4CE0-9748-7773EA94C3AF";
	this.activeXClassId="83AC1413-FCE4-4A46-9DD5-4F31F306E71F";
	this.activeXProgId="Aurigma.ThumbnailEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.Thumbnail.class";
}

function ShellComboBoxWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="8B1A14AF-E603-4356-B687-1F7D46522DD3";
	this.activeXClassId="3BF72F68-72D8-461D-A884-329D936C5581";
	this.activeXProgId="Aurigma.ShellComboEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.ShellComboBox.class";
}

function UploadPaneWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="6D9D27EE-675E-4BDE-84B1-1C9A94F98555";
	this.activeXClassId="78E9D883-93CD-4072-BEF3-38EE581E2839";
	this.activeXProgId="Aurigma.UploadPaneEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.UploadPane.class";
}

function FileDownloaderWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="FileDownloader2.cab";
	this.activeXClassId="AAB58191-AFBE-4366-93FD-1E45F7C97FA0";
	this.activeXProgId="Aurigma.FileDownloader.2";
	this.javaAppletEnabled=false;
	this.controlClass="FileDownloader";
}

function getControlObject(id){
	if (__browser.isSafari){
		return document[id];
	}
	else{
		return document.getElementById(id);
	}
}

function getImageUploader(id){
	return getControlObject(id);
}

function getFileDownloader(id){
	return getControlObject(id);
}
Rucht  
#2 Posted : Sunday, August 3, 2008 11:49:45 PM(UTC)
Rucht

Rank: Newbie

Groups: Member
Joined: 7/18/2008(UTC)
Posts: 6

I can reproduce the same bug with the multiple description sample if I active the Java applet ( this.activeXControlEnabled=false; )

How can I fix it ????
Dmitry  
#3 Posted : Tuesday, August 5, 2008 5:24:39 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello guys,

Could you provide me with detailed infrormation? What version of Image Uploader Java do you use? Could you post here the complete script used to embed Image Uploader onto your page? Also it would be better if you provide me with the link to your page where you exeprience the problem (if it is not acceptable for you to post it in public forum, please, drop me it via PM or submit a support case).
Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
Rucht  
#4 Posted : Tuesday, August 5, 2008 10:36:57 PM(UTC)
Rucht

Rank: Newbie

Groups: Member
Joined: 7/18/2008(UTC)
Posts: 6

I use image uploader 5.1 (trial version) , and I think about buy the java version.

but when I change on your sample ( multiple description sample) the iuembed.js

Code:
this.activeXControlEnabled=true;

in
Code:
this.activeXControlEnabled=false;


that not working on ie ...

there is all your code :
iuembed.js:
Code:
// Aurigma Image Uploader Dual 5.x Embedding Script 
// Version 2.0.4.0 Feb 20, 2008
// Copyright(c) Aurigma Inc. 2002-2008

function __Browser(){
	var a=navigator.userAgent.toLowerCase();
	this.isOpera=(a.indexOf("opera")!=-1);
	this.isKonq=(a.indexOf('konqueror')!=-1);
	this.isSafari=(a.indexOf('safari')!=-1)&&(a.indexOf('mac')!=-1);
	this.isKhtml=this.isSafari||this.isKonq;
	this.isIE=(a.indexOf("msie")!=-1)&&!this.isOpera;
	this.isWinIE=this.isIE;
	this.isCSS1Compat=(!this.isIE)||(document.compatMode&&document.compatMode=="CSS1Compat");
}

var __browser=new __Browser();

//Create set/get expando methods for ActiveX
function _createExpandoMethods(id){
	var o=document.getElementById(id);
	var props=new Array();
	var hasPaneItemApiElements=false;
	for (propName in o){
		var c=propName.charAt(0);
		if (c==c.toUpperCase()){
			props.push(propName);
			if (propName=="PaneItemDesign"){
				hasPaneItemApiElements=true;
			}
		}
	}
	for (i=0;i<props.length;i++){
		//Check whether property is indexed
		if (typeof(o[props[i]])=="unknown"){
			eval("o.set"+props[i]+"=function(i,v){this."+props[i]+"(i)=v;};");
			eval("o.get"+props[i]+"=function(i){return this."+props[i]+"(i);};");
		}
		else{
			eval("o.set"+props[i]+"=function(v){this."+props[i]+"=v};");
			eval("o.get"+props[i]+"=function(){return this."+props[i]+"};");
		}
	}
	if (hasPaneItemApiElements){
		eval("o.setPaneItemDesign = function(Pane, Index, Value){this.PaneItemDesign(Pane, Index) = Value;};");
		eval("o.getPaneItemDesign = function(Pane, Index){return this.PaneItemDesign(Pane, Index);};");		
		//eval("o.getPaneItemCount = function(Pane){return this.PaneItemCount(Pane);};");
		//eval("o.getPaneItemChecked = function(Index){return this.PaneItemChecked(Index);};");
		//eval("o.getPaneItemCanBeUploaded = function(Index){return this.PaneItemCanBeUploaded(Index);};");
		eval("o.getPaneItemSelected = function(Pane, Index){return this.PaneItemSelected(Pane, Index);};");
		eval("o.setPaneItemEnabled = function(Pane, Index, Value){this.PaneItemEnabled(Pane, Index) = Value;};");
		eval("o.getPaneItemEnabled = function(Pane, Index){return this.PaneItemEnabled(Pane, Index);};");
	}
}

//Installation instructions
function _addInstructions(obj){
	obj.instructionsEnabled=true;
	if (obj.controlClass=="FileDownloader"){
		obj.instructionsCommon="<p>File Downloader ActiveX control is necessary to download "+
			"files quickly and easily. You will be able to select required files "+
			"in a user-friendly interface and simply click a <strong>Download</strong> button. "+
			"Installation will take up to few minutes, please be patient. To install File Downloader, ";
		obj.instructionsNotWinXPSP2="please reload the page and click the <strong>Yes</strong> button " +
			"when you see the control installation dialog.";
		obj.instructionsWinXPSP2="please click the <strong>Information Bar</strong>. After page reload click <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsVista = "please click on the <strong>Information Bar</strong> and select <strong>Install ActiveX Control</strong> "+
			"from the dropdown menu. After page reload click <strong>Continue</strong> and then <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsCommon2="</p><p><strong>NOTE:</strong> If control fails to be installed, it may mean that it has been inserted to the page incorrectly. "+
			"Refer File Downloader documentation for more details.</p>";
	} else {
		obj.instructionsCommon="<p>Image Uploader ActiveX control is necessary to upload "+
			"your files quickly and easily. You will be able to select multiple images "+
			"in user-friendly interface instead of clumsy input fields with <strong>Browse</strong> button. "+
			"Installation will take up to few minutes, please be patient. To install Image Uploader, ";
		obj.instructionsNotWinXPSP2="please reload the page and click the <strong>Yes</strong> button " +
			"when you see the control installation dialog.";
		obj.instructionsWinXPSP2="please click on the <strong>Information Bar</strong> and select " +
			"<strong>Install ActiveX Control</strong> from the dropdown menu. After page reload click <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsVista = "please click on the <strong>Information Bar</strong> and select <strong>Install ActiveX Control</strong> "+
			"from the dropdown menu. After page reload click <strong>Continue</strong> and then <strong>Install</strong> when "+
			"you see the control installation dialog.";
		obj.instructionsCommon2="</p>";
	}
}

function ControlWriter(id,width,height){
	//Private
	this._params=new Array();
	this._events=new Array();
	
	_addInstructions(this);

	this._getObjectParamHtml=function(name,value){
		return "<param name=\""+name+"\" value=\""+value+"\" />";
	}

	this._getObjectParamsHtml=function(){
		var r="";
		var p=this._params;
		var i;
		for (i=0;i<p.length;i++){
			r+=this._getObjectParamHtml(p[i].name,p[i].value);
		}
		return r;
	}

	this._getObjectEventsHtml=function(){
		var r="";
		var e=this._events;
		for (i=0;i<e.length;i++){
			r+=this._getObjectParamHtml(e[i].name+"Listener",e[i].listener);
		}
		return r;
	}

	this._getEmbedParamHtml=function(name,value){
		return " "+name+"=\""+value+"\"";	
	}

	this._getEmbedParamsHtml=function(){
		var r="";
		var p=this._params;
		var i;
		for (i=0;i<p.length;i++){
			r+=this._getEmbedParamHtml(p[i].name,p[i].value);
		}
		return r;
	}

	this._getEmbedEventsHtml=function(){
		var r="";
		var e=this._events;
		for (i=0;i<e.length;i++){
			r+=this._getEmbedParamHtml(e[i].name+"Listener",e[i].listener);
		}
		return r;
	}

	//Public

	//Properties
	this.id=id;
	this.width=width;
	this.height=height;

	this.activeXControlEnabled=false;
	this.activeXControlVersion="";

	this.javaAppletEnabled=true;
	this.javaAppletCodeBase="./";
	this.javaAppletCached=true;
	this.javaAppletVersion="";

	this.fullPageLoadListenerName=null;

	//Methods
	this.addParam=function(paramName,paramValue){
		var p=new Object();
		p.name=paramName;
		p.value=paramValue;
		this._params.push(p);
	}

	this.addEventListener=function(eventName,eventListener){
		try
	        {
        	    	eval("var checkListener = " + eventListener + ";");
	            	if (checkListener == null)
			{
				return;
        		}
	        }
        	catch (e)
	        {
        	    	return;
	        }
		var p=new Object();
		p.name=eventName;
		p.listener=eventListener;
		this._events.push(p);
	}

	this.getActiveXInstalled=function(){
		if (this.activeXProgId){
			try{
				var a=new ActiveXObject(this.activeXProgId);
				return true;
			}
			catch(e){
				return false;
			}
		}
		return false;
	}

	this.getHtml=function(){
		var r="";
		if (this.fullPageLoadListenerName){
			r+="<" + "script type=\"text/javascript\">";
			r+="var __"+this.id+"_pageLoaded=false;";
			r+="var __"+this.id+"_controlLoaded=false;";
			r+="function __fire_"+this.id+"_fullPageLoad(){";
			r+="if (__"+this.id+"_pageLoaded&&__"+this.id+"_controlLoaded){";
			r+=this.fullPageLoadListenerName + "();";
			r+="}";
			r+="}";
			var pageLoadCode="new Function(\"__"+this.id+"_pageLoaded=true;__fire_"+this.id+"_fullPageLoad();\")";
			if (__browser.isWinIE){
				r+="window.attachEvent(\"onload\","+pageLoadCode+");";
			}
			else{
				r+="var r=window.addEventListener?window:document.addEventListener?document:null;";
				r+="if (r){r.addEventListener(\"load\","+pageLoadCode+",false);}";
			}
			r+="<"+"/script>";
		}		

		//ActiveX control
		if(__browser.isWinIE&&this.activeXControlEnabled){
			var v=this.activeXControlVersion.replace(/\./g,",")
			var cb=this.activeXControlCodeBase+(v==""?"":"#version="+v);

			r+="<" + "script for=\""+this.id+"\" event=\"InitComplete()\">";
			r+="_createExpandoMethods(\""+this.id+"\");";
			if (this.fullPageLoadListenerName){
				r+="__"+this.id+"_controlLoaded=true;";
				r+="__fire_"+this.id+"_fullPageLoad();";
			}
			r+="<"+"/script>";

			r+="<object id=\""+this.id+"\" name=\""+this.id+"\" classid=\"clsid:"+this.activeXClassId+"\" codebase=\""+cb+"\" width=\""+this.width+"\" height=\""+this.height+"\">";
			if (this.instructionsEnabled){
				r+=this.instructionsCommon;
				var isXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1) || (window.navigator.userAgent.indexOf("MSIE 7.0") != -1);
				var isVista = (window.navigator.userAgent.indexOf("Windows NT 6.0") != -1) && (window.navigator.userAgent.indexOf("MSIE 7.0") != -1);
				if (isVista) {
					r+=this.instructionsVista;
					//r+=this.instructionsWinXPSP2;
				} else if (isXPSP2) {
					r+=this.instructionsWinXPSP2;
				}
				else{
					r+=this.instructionsNotWinXPSP2;
				}
				r+=this.instructionsCommon2;
			}
			r+=this._getObjectParamsHtml();
			r+="</object>";

			//Event handlers
			var e=this._events;
			var eventParams;
			for (i=0;i<e.length;i++){
				if (this.controlClass=="FileDownloader"){
					switch (e[i].name){
						case "DownloadComplete":
							eventParams="Value";
							break;
						case "DownloadItemComplete":
							eventParams="Result, ErrorPage, Url, FileName, ContentType, FileSize";
							break;
						case "DownloadStep":
							eventParams="Step";
							break;
						case "Progress":
							eventParams="PercentTotal, PercentCurrent, Index";
							break;
						case "Error":
							eventParams="ErrorCode, HttpErrorCode, ErrorPage, Url, Index";
							break;
						default:
							eventParams="";
					}
					r+="<script for=\""+this.id+"\" event=\""+e[i].name+"("+eventParams+")\">";
					r+=e[i].listener+"("+eventParams+");";
					r+="<"+"/script>";
				}
				else {
					switch (e[i].name){
						case "Progress":
							eventParams="Status, Progress, ValueMax, Value, StatusText";
							break;
						case "InnerComplete":
							eventParams="Status, StatusText";
							break;
						case "AfterUpload":
							eventParams="htmlPage";
							break;
						case "ViewChange":
						case "SortModeChange":
							eventParams="Pane";
							break;
						case "Error":
							eventParams="ErrorCode, HttpResponseCode, ErrorPage, AdditionalInfo";
							break;
						case "PackageBeforeUpload":
							eventParams = "PackageIndex";
						    	break;
						case "PackageError":
						    	eventParams = "PackageIndex, ErrorCode, HttpResponseCode, ErrorPage, AdditionalInfo";
						    	break;
						case "PackageComplete":
						    	eventParams = "PackageIndex, ResponsePage";
						    	break;
						case "PackageProgress":
						    	eventParams = "PackageIndex, Status, Progress, ValueMax, Value, StatusText";
						    	break;
						default:
							eventParams="";
					}
				}
				r+="<" + "script for=\""+this.id+"\" event=\""+e[i].name+"("+eventParams+")\">";
				if (e[i].name=="BeforeUpload"){
					r+="return ";
				}
				r+=e[i].listener+"("+eventParams+");";
				r+="<"+"/script>";
			}

		}
		else 
		//Java appplet
		if(this.javaAppletEnabled){
			if (this.fullPageLoadListenerName){
				r+="<" + "script type=\"text/javascript\">";
				r+="function __"+this.id+"_InitComplete(){";
				r+="__"+this.id+"_controlLoaded=true;";
				r+="__fire_"+this.id+"_fullPageLoad();";
				r+="}";
				r+="<"+"/script>";
			}

			//<object> for IE and <applet> for Safari
			if (__browser.isWinIE||__browser.isKhtml){
				if (__browser.isWinIE){
					r+="<object id=\""+this.id+"\" classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\" codebase=\""+window.location.protocol+"//java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0\" width=\""+this.width+"\" height=\""+this.height+"\">";
				}
				else{
					r+="<applet id=\""+this.id+"\" code=\""+this.javaAppletClassName+"\" java_codebase=\"../\" align=\"baseline\" archive=\""+this.javaAppletJarFileName+"\" mayscript=\"true\" scriptable=\"true\" width=\""+this.width+"\" height=\""+this.height+"\">";
				}

				if (this.javaAppletCached&&this.javaAppletVersion!=""){
					r+=this._getObjectParamHtml("cache_archive",this.javaAppletJarFileName);
					var v=this.javaAppletVersion.replace(/\,/g,".");
					//r+=this._getObjectParamHtml("cache_version",v+","+v);
					r+=this._getObjectParamHtml("cache_version",v);
				}

				r+=this._getObjectParamHtml("type","application/x-java-applet;version=1.4");
				r+=this._getObjectParamHtml("codebase",this.javaAppletCodeBase);
				r+=this._getObjectParamHtml("archive",this.javaAppletJarFileName);
				r+=this._getObjectParamHtml("code",this.javaAppletClassName);
				r+=this._getObjectParamHtml("scriptable","true");
				r+=this._getObjectParamHtml("mayscript","true");

				r+=this._getObjectParamsHtml();

				r+=this._getObjectEventsHtml();

				if (this.fullPageLoadListenerName){
					r+=this._getObjectParamHtml("InitCompleteListener","__"+this.id+"_InitComplete");
				}
				if (__browser.isWinIE){
					r+="</object>";
				}
				else{
					r+="</applet>";
				}
			}
			//<embed> for all other browsers
			else{
				r+="<embed id=\""+this.id+"\" type=\"application/x-java-applet;version=1.4\" codebase=\""+this.javaAppletCodeBase+"\" code=\""+this.javaAppletClassName+"\" archive=\""+this.javaAppletJarFileName+"\" width=\""+this.width+"\" height=\""+this.height+"\" scriptable=\"true\" mayscript=\"true\" pluginspage=\""+window.location.protocol+"//java.sun.com/products/plugin/index.html#download\"";

				if (this.javaAppletCached&&this.javaAppletVersion!=""){
					r+=this._getEmbedParamHtml("cache_archive",this.javaAppletJarFileName);
					var v=this.javaAppletVersion.replace(/\,/g,".");
					//r+=this._getEmbedParamHtml("cache_version",v+","+v);
					r+=this._getEmbedParamHtml("cache_version",v);
				}

				r+=this._getEmbedParamsHtml();

				r+=this._getEmbedEventsHtml();

				if (this.fullPageLoadListenerName){
					r+=this._getEmbedParamHtml("InitCompleteListener","__"+this.id+"_InitComplete");
				}
				r+=">";
				r+="</embed>";
			}
		}
		else
		{
			r+="Your browser is not supported.";
		}
		
		//For backward compatibility
		this.controlType=this.getControlType();
			
		return r;
	}

	this.getControlType=function(){
		return (__browser.isWinIE&&this.activeXControlEnabled)?"ActiveX":(this.javaAppletEnabled?"Java":"None");
	}
	
	this.writeHtml=function(){
		document.write(this.getHtml());
	}
}

function ImageUploaderWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private-label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="BA162249-F2C5-4851-8ADC-FC58CB424243";
	this.activeXClassId="5D637FAD-E202-48D1-8F18-5B9C459BD1E3";
	this.activeXProgId="Aurigma.ImageUploaderEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.ImageUploader.class";

	//Extend
	this.showNonemptyResponse="off";
	this._getHtml=this.getHtml;
	this.getHtml=function(){
		var r="";
		if (this.showNonemptyResponse!="off"){
			r+="<" + "script type=\"text/javascript\">";
			r+="function __"+this.id+"_InnerComplete(Status,StatusText){";
			r+="if (new String(Status)==\"COMPLETE\" && new String(StatusText).replace(/\\s*/g,\"\")!=\"\"){";
			if (this.showNonemptyResponse=="dump"){
				r+="var f=document.createElement(\"fieldset\");";
				r+="var l=f.appendChild(document.createElement(\"legend\"));";
				r+="l.appendChild(document.createTextNode(\"Server Response\"));";
				r+="var d=f.appendChild(document.createElement(\"div\"));";
				r+="d.innerHTML=StatusText;";
				r+="var b=f.appendChild(document.createElement(\"button\"));";
				r+="b.appendChild(document.createTextNode(\"Clear Server Response\"));";
				r+="b.onclick=function(){var f=this.parentNode;f.parentNode.removeChild(f)};";
				r+="document.body.appendChild(f);";
			}
			else{
				var s="";
				for (var i=0;i<80;i++){s+="-";}
				r+="alert(\""+s+"\\r\\nServer Response\\r\\n"+s+"\\r\\n\"+StatusText);";
			}
			r+="}";
			r+="}";
			r+="<"+"/script>";
			this.addEventListener("InnerComplete","__"+this.id+"_InnerComplete");
		}
		return r+this._getHtml();
	}
}

function ThumbnailWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="27BE1679-6AEE-4CE0-9748-7773EA94C3AF";
	this.activeXClassId="83AC1413-FCE4-4A46-9DD5-4F31F306E71F";
	this.activeXProgId="Aurigma.ThumbnailEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.Thumbnail.class";
}

function ShellComboBoxWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="8B1A14AF-E603-4356-B687-1F7D46522DD3";
	this.activeXClassId="3BF72F68-72D8-461D-A884-329D936C5581";
	this.activeXProgId="Aurigma.ShellComboEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.ShellComboBox.class";
}

function UploadPaneWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="ImageUploader5.cab";
	//this.activeXClassId="6D9D27EE-675E-4BDE-84B1-1C9A94F98555";
	this.activeXClassId="78E9D883-93CD-4072-BEF3-38EE581E2839";
	this.activeXProgId="Aurigma.UploadPaneEx.5";
	this.javaAppletJarFileName="ImageUploader5.jar";
	this.javaAppletClassName="com.aurigma.imageuploader.UploadPane.class";
}

function FileDownloaderWriter(id,width,height){
	this._base=ControlWriter;
	this._base(id,width,height);
	//These properties should be modified for private label versions only
	this.activeXControlCodeBase="FileDownloader2.cab";
	this.activeXClassId="AAB58191-AFBE-4366-93FD-1E45F7C97FA0";
	this.activeXProgId="Aurigma.FileDownloader.2";
	this.javaAppletEnabled=false;
	this.controlClass="FileDownloader";
}

function getControlObject(id){
	if (__browser.isSafari){
		return document[id];
	}
	else{
		return document.getElementById(id);
	}
}

function getImageUploader(id){
	return getControlObject(id);
}

function getFileDownloader(id){
	return getControlObject(id);
}


index.php:

Code:
<!--BEGIN-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Aurigma Image Uploader</title>

	<script src="../iuembed.js" type="text/javascript"></script>

	<script src="script.js" type="text/javascript"></script>

	<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
	<p>
		This demo application shows to create custom upload pane through HTML code. This
		custom pane allows to associate additional data with each data - file title and
		description. It can be easily modified to send any other data. In addition, it demonstrates
		how to:
	</p>
	<ul>
		<li>Create custom HTML buttons for Image Uploader instead of standard ones.</li>
		<li>Upload thumbnail along with a source file.</li>
	</ul>
	<fieldset>
		<legend>Note</legend>This demo application <strong>deletes all previously uploaded files</strong>.
		Keep in mind that it is a feature of this demo, not of Image Uploader itself. If
		you <strong>do not want to delete uploaded files</strong>, you should modify the
		upload processing page specified by the <strong>Action</strong> parameter.
	</fieldset>
	<table>
		<tbody>
			<tr>
				<td align="right">
					<input id="UploadButton" type="button" value="&nbsp;&nbsp;Upload Files&nbsp;&nbsp;" disabled="disabled" onclick="UploadButton_click();" />
				</td>
			</tr>
			<tr>
				<td>

					<script type="text/javascript">
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 650, 250);

//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "../ImageUploader5.cab";
iu.activeXControlVersion = "5,1,10,0";

//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletJarFileName = "ImageUploader5.jar";
iu.javaAppletCodeBase = "../";
iu.javaAppletCached = true;
iu.javaAppletVersion = "5.1.10.0";

iu.showNonemptyResponse = "off";

//Configure License Keys
iu.addParam("LicenseKey", "71050-43C8A-00000-0C12B-1E4E4;72050-43C8A-00000-05DCD-A87F9");

//Configure appearance.
iu.addParam("PaneLayout", "ThreePanes");
iu.addParam("FolderView", "Thumbnails");

iu.addParam("BackgroundColor", "#eff1f9");
iu.addParam("ShowUploadListButtons", "true");
iu.addParam("ButtonRemoveFromUploadListText", "");
iu.addParam("ButtonRemoveAllFromUploadListText", "");

iu.addParam("ShowDescriptions", "false");
iu.addParam("AllowRotate", "false");
iu.addParam("ShowButtons", "false");

//Hide standard upload pane.
iu.addParam("FolderPaneHeight", "-1");

//Configure thumbnail settings.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "120");
iu.addParam("UploadThumbnail1Height", "120");
iu.addParam("UploadThumbnail1JpegQuality", "60");

//Configure URL files are uploaded to.
iu.addParam("Action", "index.php");

//Configure URL where to redirect after upload.
iu.addParam("RedirectUrl", "gallery.php");

//Add event handlers.
iu.addEventListener("UploadFileCountChange", "ImageUploader_UploadFileCountChange");
iu.addEventListener("BeforeUpload", "ImageUploader_BeforeUpload")
iu.fullPageLoadListenerName = "fullPageLoad";

//Tell Image Uploader writer object to generate all necessary HTML code to embed 
//Image Uploader to the page.
iu.writeHtml();
					</script>

				</td>
			</tr>
			<tr>
				<td>
				<!--
				        The code which forms the upload pane itself is located in a separate script.js file.
				        It is highly recommended to keep this code in a separate file to avoid problems with 
				        Internet Explorer with security update 912945 (ActiveX controls activation):
				        
				        http://support.microsoft.com/kb/912945/en-us 
				-->
					<div id="UploadPaneFrame">
						<div id="UploadPane"></div>
					</div>
				</td>
			</tr>
		</tbody>
	</table>
</body>
</html>
<!--END-->

<?php
//This variable specifies relative path to the folder, where the gallery with uploaded files is located.
//Do not forget about the slash in the end of the folder name.
$galleryPath = "../../../MPv4/images/screenshots";

$absGalleryPath = realpath($galleryPath) . "/";
$absThumbnailsPath = realpath($galleryPath . "Thumbnails/") . "/";

function saveUploadedFiles()
{
	global $absGalleryPath, $absThumbnailsPath;
	
	//First of all, clear files and data uploaded at previous time.
	
	//Delete source files.
	$handle = opendir($absGalleryPath);

	while (false !== ($file = readdir($handle)))
	{
		if (is_file($absGalleryPath . $file))
		{
			unlink($absGalleryPath . $file);
		}
	}
	closedir($handle); 

	//Delete thumbnails
	$handle = opendir($absThumbnailsPath);	
	while (false !== ($file = readdir($handle))) 
	{
		if (is_file($absThumbnailsPath . $file))
		{
			unlink($absThumbnailsPath . $file);
		}
	}
	closedir($handle);

	//NOTE: If you do not want to delete previously uploaded files, just 
	//remove or comment out the code above.
	
	//Create XML file which will keep information about files (image dimensions, description, etc). 
	//XML is used solely for brevity. In real-life application most likely you will use database instead.
	$descriptions = new DOMDocument('1.0');
	$descriptions->appendChild($descriptions->createElement("files"));
	
	//Get total number of uploaded files (all files are uploaded in a single package).
	$fileCount = $_POST ["FileCount"];
	
	//Iterate through uploaded data and save the original file, thumbnail, and description.
	for ($i = 1; $i <= $fileCount; $i++)
	{
		//Get source file and save it to disk.
		$sourceFileField = "SourceFile_" . $i;
		if (!$_FILES[$sourceFileField]['size'])
		{
			return;	
		}
		$fileName = getSafeFileName($_FILES[$sourceFileField]['name']);
		move_uploaded_file($_FILES[$sourceFileField]['tmp_name'], $absGalleryPath . "/" . $fileName);

		//Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
		$thumbnail1Field = "Thumbnail1_" . $i;
		if (!$_FILES[$thumbnail1Field]['size'])
		{
			return;	
		}
		move_uploaded_file($_FILES[$thumbnail1Field]['tmp_name'], $absGalleryPath . "/Thumbnails/" . $fileName . ".jpg");

		//Save file info.
		$xmlFile = $descriptions->createElement("file");
		$xmlFile->setAttribute("name", $fileName);
		$xmlFile->setAttribute("width", $_POST ['Width_' . $i]);
		$xmlFile->setAttribute("height", $_POST ['Height_' . $i]);
		$xmlFile->setAttribute("title", $_POST ['Title_' . $i]);		
		$xmlFile->setAttribute("description", $_POST ['Description_' . $i]);
		$descriptions->documentElement->appendChild($xmlFile);
	}

	$descriptions->save($absGalleryPath . "Descriptions.xml");
}

//This method verifies whether file with such name already exists 
//and if so, construct safe filename name (to avoid collision).	
function getSafeFileName($fileName)
{
	global $absGalleryPath;
	
	$newFileName = $fileName;
	$j = 1;
	while (file_exists($absGalleryPath . "/" . $newFileName))
	{
		$newFileName = $j . "_" . $fileName;
		$j = $j + 1;
	}
	return $newFileName;	
}

saveUploadedFiles();
?>


script.js:
[code]var imageUploader1 = null;
var uniqueId = 0;
var prevUploadFileCount = 0;
var dragAndDropEnabled = true;


var allowDrag = false;

function fullPageLoad(){
imageUploader1 = getImageUploader("ImageUploader1");

var UploadPane=document.getElementById("UploadPane");

while (UploadPane.childNodes.length > 0){
UploadPane.removeChild(UploadPane.childNodes[0]);
}

//Fix Opera applet z-order bug
if (__browser.isOpera){
UploadPane.style.height = "auto";
UploadPane.style.overflow = "visible";
}


//Handle drag & drop.
if (__browser.isIE || __browser.isSafari){
var target = __browser.isIE ? UploadPane : document.body;
target.ondragenter = function(){
var e=window.event;
var data = e.dataTransfer;
if (data.getData('Text')==null){
this.ondragover();
data.dropEffect="copy";
allowDrag=true;
}
else{
allowDrag=false;
}
}

target.ondragover=function(){
var e = window.event;
e.returnValue = !allowDrag;
}

target.ondrop = function(){
var e = window.event;
this.ondragover();
e.dataTransfer.dropEffect = "none";
processDragDrop();
}
}
else {
window.captureEvents(Event.DRAGDROP);
window.addEventListener("dragdrop", function(){
processDragDrop();
}, true);
}

}

function processDragDrop(){
alert("Adding files with drag & drop can not be implemented in standard version due security reasons. However it can be enabled in private-label version."+
"\r\n\r\nFor more information please contact us at sales@aurigma.com");
if (imageUploader1){
//imageUploader1.AddToUploadList();
}
}

//To identify items in upload list, GUID are used. However it would work
//too slow if we use GUIDs directly. To increase performance, we will use
//hash table which will map the guid to the index in upload list.

//This function builds and returns the hash table which will be used for
//fast item search.
function getGuidIndexHash(){
var uploadFileCount = imageUploader1.getUploadFileCount();
var guidIndexHash = new Object();
for (var i = 1; i <= uploadFileCount; i++){
guidIndexHash["" + imageUploader1.getUploadFileGuid(i)] = i;
}
return guidIndexHash;
}

//This function returns HTML which represent the single item in the custom upload pane.
//It contains of the Thumbnail object and form elements for each piece of data (in our
//case - title and description). If you want to upload extra data, you should write
//additional form elements here.
//
//It is highly recommended not to copy this function into the main HTML page to
//avoid problems with activation of ActiveX controls in Internet Explorer with
//security update 912945. You can read more detailed about activation on Microsoft website:
//
//http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp
function addUploadFileHtml(index){
var guid = "" + imageUploader1.getUploadFileGuid(index);
var fileName = "" + imageUploader1.getUploadFileName(index);

var h = "<table cellspacing=\"5\"><tbody>";
h += "<tr>";
h += "<td class=\"Thumbnail\" align=\"center\" valign=\"middle\">";

//Add thumbnail control and link it with Image Uploader by its name and GUID.
var tn = new ThumbnailWriter("Thumbnail" + uniqueId, 96, 96);
//Copy codebase and version settings from ImageUploaderWriter instance.
tn.activeXControlCodeBase = iu.activeXControlCodeBase;
tn.activeXControlVersion = iu.activeXControlVersion;
tn.javaAppletCodeBase = iu.javaAppletCodeBase;
tn.javaAppletCached = iu.javaAppletCached;
tn.javaAppletVersion = iu.javaAppletVersion;

tn.addParam("ParentControlName", "ImageUploader1");
tn.addParam("Guid", guid);
tn.addParam("FileName", fileName);
h += tn.getHtml();

h += "</td>";
h += "<td valign=\"top\">";

//Add Title element.
h += "Title:<br />";
h += "<input id=\"Title" + uniqueId + "\" class=\"Title\" type=\"text\" /><br />";

//Add Description element.
h += "Description:<br />";
h += "<textarea id=\"Description" + uniqueId + "\" class=\"Description\"\"></textarea>";

h += "</td>";
h += "</tr>";
h += "<tr>";
h += "<td align=\"center\"><a href=\"#\" onclick=\"return Remove_click('" + guid + "');\">Remove</a></td>";
h += "<td></td>";
h += "</tr>";
h += "</tbody></table>";

//Create DIV element which will represent the upload list item.
var div = document.createElement("div");
div.className = "UploadFile";
div.innerHTML = h;
div._guid = guid;
//_uniqueId is used for fast access to the Title and Description form elements.
div._uniqueId = uniqueId;

//Append this upload list item to the custom upload pane.
document.getElementById("UploadPane").appendChild(div);

//Increase the ID to guaranty uniqueness.
uniqueId++;
}

//Synchronize custom upload pane with Image Uploader upload list when
//some files are added or removed.
function ImageUploader_UploadFileCountChange(){
if (imageUploader1){
var uploadFileCount = imageUploader1.getUploadFileCount();

//Files are being added.
if (prevUploadFileCount <= uploadFileCount){
for (var i = prevUploadFileCount + 1; i <= uploadFileCount; i++){
addUploadFileHtml(i);
}
}
//Files are being removed.
else{
var guidIndexHash = getGuidIndexHash();
var UploadPane = document.getElementById("UploadPane");
var i = UploadPane.childNodes.length - 1;
while (i >= 0){
if (guidIndexHash["" + UploadPane.childNodes[i]._guid] == undefined){
UploadPane.removeChild(UploadPane.childNodes[i]);
}
i--;
}
}

prevUploadFileCount = uploadFileCount;

document.getElementById("UploadButton").disabled = (uploadFileCount == 0);
}
}

//Append the additional data entered by the user (title and description)
//to the upload. If you add more fields, do not forget to modify this event
//handler to call AddField for these fields.
function ImageUploader_BeforeUpload(){
var guidIndexHash = getGuidIndexHash();

var UploadPane = document.getElementById("UploadPane");

for (var i = 0; i < UploadPane.childNodes.length; i++){
var div = UploadPane.childNodes[i];

var index =...
Dmitry  
#5 Posted : Wednesday, August 6, 2008 11:24:13 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Good evening,

Your script looks okay.

Could you provide me with a link to the page where you experience the problem? You can send it me via PM or submit a case with this information.
Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.