<!---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.--->
<cfset galleryPath="../Gallery/" />
		
<cfset absGalleryPath="#ExpandPath(galleryPath)#" />
<cfset absThumbnailsPath="#absGalleryPath#Thumbnails/" />

<!---Delete source files.--->
<cfdirectory name="galleryDir" action="list" 
			directory="#absGalleryPath#" filter="*" />
<cfloop query="galleryDir">
	<cfif FileExists("#absGalleryPath##Name#")>
		<cffile action="delete" file="#absGalleryPath##Name#" />
	</cfif>
</cfloop>

<!---Delete thumbnails.--->
<cfdirectory name="thumbnailsDir" action="list" 
			directory="#absThumbnailsPath#" filter="*">
<cfloop query="thumbnailsDir"> 
	<cfif FileExists("#absThumbnailsPath##Name#")>
		<cffile action="delete" file="#absThumbnailsPath##Name#" />
	</cfif>
</cfloop>

<!---NOTE: If you do not want to delete previously uploaded files, just 
remove or comment out the code above.--->

<!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 Demos &mdash; Concurrent Upload Demo</title>

	<link href="../common.css" type="text/css" rel="stylesheet" />

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

	<script type="text/javascript">
function ImageUploader1_BeforeUpload() {
	getImageUploader("ImageUploader1").setButtonStopText("Stop");
	needToHideButtonStop = false;
}

function ImageUploader1_Progress(Status, Progress, ValueMax, Value, StatusText) {
	//Stop button should be displayed only during the upload process. If the upload 
	//completed (either successfully or not), the button should be hidden.
	needToHideButtonStop = (Status=="COMPLETE" || Status=="ERROR" || Status=="CANCEL");
}	

var needToHideButtonStop = false;
window.setInterval("if (needToHideButtonStop) {getImageUploader('ImageUploader1').setButtonStopText(''); needToHideButtonStop = false;}", 500);
	</script>
</head>
<body>
	<form>
		<h1><a href="../index.cfm">Aurigma Image Uploader Demos</a> &rarr; Concurrent Upload Demo</h1>
		<p>
			This sample application demonstrates how to make Image Uploader to upload files
			asynchronously through several concurrent HTTP connections. In addition this demo
			highlights the following features:</p>
		<ul>
			<li>Advanced details view (with progress bar inside the upload pane).</li>
			<li>Automatic recovery of broken connection.</li>
			<li>Upload thumbnail along with a source file.</li>
			<li>Upload to several URLs.</li>
		</ul>
		<div class="note">
			<h4>Note</h4>
			<p>
				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.
			</p>
		</div>

		<script type="text/javascript">
//<![CDATA[	

function ImageUploader1_BeforeUpload() {
	getImageUploader("ImageUploader1").setButtonStopText("Stop");
	needToHideButtonStop = false;
}

function ImageUploader1_Progress(Status, Progress, ValueMax, Value, StatusText) {
	//Stop button should be displayed only during the upload process. If the upload 
	//completed (either successfully or not), the button should be hidden.
	needToHideButtonStop = (Status=="COMPLETE" || Status=="ERROR" || Status=="CANCEL");
}

//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 650, 400);

//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "../Scripts/ImageUploader6.cab";
iu.activeXControlVersion = "6,5,31,0";

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

iu.showNonemptyResponse = "off";

//Set and configure advanced details view.
iu.addParam("PaneLayout", "OnePane");
iu.addParam("UploadView", "AdvancedDetails");
iu.addParam("AdvancedDetailsPreviewThumbnailSize", "40");

//Configure License Keys
iu.addParam("LicenseKey", "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX;XXXXX-XXXXX-XXXXX-XXXXX-XXXXX");

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

//Configure upload settings.
iu.addParam("FilesPerOnePackageCount", "1");
iu.addParam("AutoRecoverMaxTriesCount", "5");
iu.addParam("AutoRecoverTimeOut", "10000");
iu.addParam("MaxConnectionCount", "3");

//Set several URLs files should be uploaded to. In a real life most likely
//you will specify URLs to different servers, however in this demo the single
//server and page is used for brevity.
iu.addParam("Action", "upload.cfm?handlerId=1;upload.cfm?handlerId=2;upload.cfm?handlerId=3");

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

//Configure miscellaneous settings.
iu.addParam("ShowDebugWindow", "true");
iu.addParam("BackgroundColor", "#ffffff");
iu.addParam("ShowContextMenu", "false");
iu.addParam("SilentMode", "true");

//Add event handlers.
iu.addEventListener("BeforeUpload", "ImageUploader1_BeforeUpload");
iu.addEventListener("Progress", "ImageUploader1_Progress");

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

</body>
</html>
<!--END-->