<%@  language="VBScript" %>
<%
Option Explicit
%>
<!--#include file="config.asp"-->
<%
'This variable specifies a relative path to the folder, where the gallery with uploaded files is located.
'Do not forget about the slash at the end of the folder name.
Dim strGalleryPath
strGalleryPath = "Gallery/"

On Error Resume Next

'Check whether upload component is installed.
Dim blnUploadComponent, strUploadComponentName, objUpload

Select Case strUploadComponent
	Case "PersistsAspUpload"
		Set objUpload = Server.CreateObject("Persits.Upload")
		blnUploadComponent = (Err.number = 0)	
		strUploadComponentName = "Persists AspUpload"
	Case "AspSmartUpload"
		Set objUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
		blnUploadComponent = (Err.number = 0)	
		strUploadComponentName = "aspSmartUpload"
	Case "DundasUpload"
		Set objUpload = Server.CreateObject("Dundas.Upload.2")
		blnUploadComponent = (Err.number = 0)
		strUploadComponentName = "Dundas Upload"
	Case "ABCUpload"
		Set objUpload = Server.CreateObject("ABCUpload4.XForm")
		blnABCUpload = (Err.number = 0)
		strUploadComponentName = "ABCUpload"		
	Case Else
		blnUploadComponent = False
End Select

Err.Clear

'Check whether upload component is installed.
Dim blnHashComponent, objHash

Set objHash = Server.CreateObject("Aurigma.HashGenerator")
blnHashComponent = (Err.number = 0)	

Err.Clear


'Check Gallery Permissions. To do it, we just try to create and remove the file in 
'the ../Gallery/ folder. If we fail, check the permissions for this folder.
Dim objFS
Set objFS = Server.CreateObject("Scripting.FileSystemObject")
Dim objText
Set objText = objFS.CreateTextFile(Server.MapPath(strGalleryPath & "test.txt"))
objText.WriteLine "test"
objText.Close()
objFS.DeleteFile Server.MapPath(strGalleryPath & "test.txt")

Dim blnGalleryPermissions
blnGalleryPermissions = (Err.number = 0)

Err.Clear

On Error Goto 0
%>
<!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 5.1 - ASP Samples</title>
	<style type="text/css"> 
body, p, ul, li, td
{
	font-size: 11px; 
	font-family: verdana, arial, sans-serif, helvetica;
}



.Sample
{
	border: 1px dashed #5382a1;
	padding: 4px;
	margin-bottom: 5px;
}

.Sample .Title
{
	margin-top: 4px;
	margin-bottom: 4px;	
}

.Sample .Title a
{
	font-weight: 700;
	font-size:12px;
	color: #013da4; 
}

.Sample .Description
{
	margin-left: 20px;
	margin-top: 6px;
	margin-bottom: 4px;		
}

.Sample .Platform
{
	padding-left: 20px;
	padding-top: 4px;
	padding-bottom: 4px;	
}

.Sample .Platform td
{
	padding: 3px;
	border-bottom: 1px dotted #cccccc;	
	border-right: 1px dotted #cccccc;
}

.Sample .Platform .ActiveX td
{
	border-top: 1px dotted #cccccc;
}

.Sample .Platform .Icon
{
	width: 50px;
	text-align: center;
	border-left: 1px dotted #cccccc;
}

fieldset
{
	border: 1px dashed #ff794b;
	padding: 3px;
	margin-top:4px;
	margin-bottom:4px;	
}

fieldset legend
{
	border: 1px dashed #ff794b;
	background-color: #ffffd7;
	padding: 3px;
	font-weight: 700;
	margin-left:12px;
}
	</style>
</head>
<body>
	<table width="100%" cellpadding="5" style="border-bottom: solid 9px #f0eef1">
		<tr>
			<td>
				<img src="Common/ImageUploader.gif" alt="Image Uploader" />
			</td>
			<td valign="middle" align="center">
				<span style="font-size: 18px; font-weight: 700"><span style="white-space: nowrap">Aurigma
					Image Uploader 5.1 -</span> <span style="white-space: nowrap">ASP Samples</span></span>
			</td>
		</tr>
	</table>
	<fieldset>
		<legend>Important</legend>
		<p>
			These demo applications are just examples of Image Uploader usage. Image Uploader
			is a <strong>client-side control/applet</strong> (i.e. <code>ImageUploader5.cab</code>
			and <code>ImageUploader5.jar</code> file). All other code (both HTML/JavaScript and
			server pages)<strong> is not a part of Image Uploader</strong>! All actions performed
			on server (such as saving files to folders, deleting previously uploaded files,
			and others) are done by that code rather than by Image Uploader.</p>
		<p>
			Keep in mind that these demo applications are intended for <strong>demonstration purposes
				only</strong>. It is not recommended to use it in production. For real-life
			applications you should write your own code which takes into account your project specifics.
		</p>
		<p>
			However you can use these demos as starter kits that illustrate how to use Image
			Uploader in some typical situations. Feel free to copy and modify the code from
			these applications.
		</p>
	</fieldset>
	<p>
		Image Uploader ASP samples support <b>Dundas Upload</b> (<a href="http://aspalliance.com/dundas/default.aspx" target="_blank">http://aspalliance.com/dundas/default.aspx</a>),
		<b>aspSmartUpload</b> (<a href="http://www.aspsmart.com/aspSmartUpload/" target="_blank">http://www.aspsmart.com/aspSmartUpload/</a>),
		<b>ABCUpload</b> (<a href="http://www.websupergoo.com/abcupload-1.htm" target="_blank">http://www.websupergoo.com/abcupload-1.htm</a>),
		and <b>Persists AspUpload</b> (<a href="http://www.aspupload.com/" target="_blank">http://www.aspupload.com/</a>),
		but you can implement support of any other components.</p>
	<p>Currently the <b><%=strUploadComponent%></b> component is specified in the <b>config.asp</b>.</p>
	<%
If blnUploadComponent And blnGalleryPermissions And blnHashComponent Then
	%>
	<p>
		Application is configured properly.</p>
	<%
Else
	If Not blnUploadComponent Then
%>
	<div style="background-color:red;padding:1px;margin:5px;">
		<p style="color: white">The <%=strUploadComponent%> component is not installed. Please, either install it or specify another upload component in <b>config.asp</b>.</p>
	</div>
<%
	End If
	If Not blnHashComponent Then
%>
	<div style="background-color:red;padding:1px;margin:5px;">
		<p style="color: white">For running Robust Upload sample you should install the free
		HashGenerator component from Aurigma (<a href="http://www.aurigma.com/go?id=51" target="_blank" style="color: #DDDDDD">http://www.aurigma.com/go?id=51</a>).</p>
	</div>
<%
	End If
	If Not blnGalleryPermissions Then
	%>
	<div style="background-color:red;padding:1px;margin:5px;">	
		<p style="color: white">
			<strong>IMPORTANT</strong>: Check permissions for the <code>Gallery</code> folder
			(<code><%=Server.MapPath(strGalleryPath)%></code>):</p>
		<ul>
			<li style="color: white">If you use IIS 5.x (<b>Windows 2000</b> or <b>Windows XP</b>), grant
				<i>modify</i> permissions to the <code>IUSR_&lt;MACHINENAME&gt;</code> and <code>ASPNET</code>
				users.</li>
			<li style="color: white">If you use IIS 6 (<b>Windows 2003</b>) grant <i>modify</i> permissions
				to the <code>NETWORK SERVICE</code> group.</li>
		</ul>
	</div>
	<%
	End If
End If
	%>
	<div class="Sample">
		<div class="Title">
			<a href="BasicDemo/default.asp" target="iu">Basic Demo</a>
		</div>
		<div class="Description">
			The simplest <strong>quick start demo</strong> which illustrates how to use Image
			Uploader to send images with thumbnails to the server and redirect after the upload.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" width="25" height="40" />
					</td>
					<td>
						Full support.</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="UserQuota/default.asp" target="iu">User Quota</a>
		</div>
		<div class="Description">
			Application which shows how to allow users to upload not more than <strong>specific number
				of files and/or file size</strong>. In particular it explains how to <strong>display user
					quota dynamically</strong>. In addition, it demonstrates how to
			make user interface customization.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" />
					</td>
					<td>
						Partial support. Unavailable features:
						<ul>
							<li>Certain appereance customization parameters (<em>see comments in source code for details</em>).</li>
						</ul>
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="OptimizedUpload/default.asp" target="iu">Optimized Upload</a></div>
		<div class="Description">
			Demo application which reveals how to use Image Uploader to <strong>reduce the amount of
				traffic</strong> when uploading images. In this demo Image Uploader <strong>sends resized
					versions of images</strong> instead of original files. It automatically
			preserves EXIF information stored in original files. Moreover, EXIF data is used
			to <strong>rotate an image automatically</strong> if it has wrong orientation. Also,
			here you will learn how to send additional information in attached HTML form along
			with files.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" width="25" height="40" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="PhotoOrder/default.asp" target="iu">Photo Order</a></div>
		<div class="Description">
			Demo application that shows how Image Uploader can be used to build a <strong>photo order
				cart</strong>. In this application you can see how to configure quality
			meter, automatic upload recovery, and file restriction rules. Also, this application
			is a great illustration how to work with items selected for the upload through the
			JavaScript.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="Localization/default.asp" target="iu">Localization</a></div>
		<div class="Description">
			Multilanguage Image Uploader-based upload application. It demonstrates how to <strong>translate</strong>
			Image Uploader user interface into <strong>different languages</strong> and switch
			dynamically between them. Also, this demo contains ready-to-use translations to
			different languages that can be easily reused (even in single-language mode).
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" width="25" height="40" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="ConcurrentUpload/default.asp" target="iu">Concurrent Upload</a>
		</div>
		<div class="Description">
			Application which demonstrates how to <strong>upload</strong> multiple files in
			<strong>several threads concurrently</strong>. Also, this is one more example how
			to customize Image Uploader appearance.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" />
					</td>
					<td>
						Partial support. Unavailable features:
						<ul>
							<li>Concurrent upload.</li>
							<li>Advanced details view. </li>
						</ul>
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="OpenFileDialog/default.asp" target="iu">Open File Dialog</a>
		</div>
		<div class="Description">
			Emulation of <strong>Open File dialog</strong> based on Image Uploader and auxiliary
			<code>ShellComboBox</code> control. This is a good example how to use these two
			controls together to synchronize Image Uploader folders when the user selects a
			folder in this combo-box. Additionally, this application demonstrates how to <strong>upload</strong>
			not just files, but <strong>whole folders</strong>. The automatic upload recovery
			feature is enabled in this demo as well.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" width="25" height="40" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="MultipleDescriptions/default.asp" target="iu">Multiple Descriptions</a></div>
		<div class="Description">
			Demo application that reveals how to upload <strong>supplementary information along with
				each file</strong> (in addition to the built-in file description field).
			This demo illustrates how to <strong>create a custom upload pane</strong> via HTML/JavaScript.
			It uses auxiliary control named <code>Thumbnail</code> for this purpose. Also, this
			is one more example how to work with items in the upload list through JavaScript.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="RobustUpload/default.asp" target="iu">Robust Upload</a>
		</div>
		<div class="Description">
			Demo application which shows not just how to send files to the server, but also
			how to <strong>verify integrity</strong> of uploaded files. To do it, Image Uploader
			generate hash value that is used to check whether the image was corrupted during
			upload (see details in the source code). Additionally, this demo illustrates one
			more look-and-feel customization feature - how to <strong>replace standard Image Uploader
				buttons by custom images</strong> without taking them into HTML.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" width="25" height="40" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="Watermark/default.asp" target="iu">Watermark</a>
		</div>
		<div class="Description">
			Application that demonstrates how to <strong>draw a text watermark</strong> on each
			image uploaded to the server. The watermark text in this demo is provided by the
			user.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="Sample">
		<div class="Title">
			<a href="ServerImaging/default.asp" target="iu">Server Imaging</a>
		</div>
		<div class="Description">
			Example of application which performs additional image processing on the server
			after images are uploaded. It <strong>rotates uploaded images</strong> if necessary
			and <strong>adds a border</strong> to them. Unlike other demo applications, Image
			Uploader is used merely for the upload. None of imaging operations is made with
			it.
		</div>
		<div class="Platform">
			<table width="100%" cellspacing="0">
				<tr class="ActiveX">
					<td class="Icon">
						<img src="Common/ActiveX.png" alt="ActiveX" width="40" height="22" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
				<tr>
					<td class="Icon">
						<img src="Common/Java.png" alt="Java" width="25" height="40" />
					</td>
					<td>
						Full support.
					</td>
				</tr>
			</table>
		</div>
	</div>
	<p>
		These demo applications are also available for other server platforms and languages:
	</p>
	<ul>
		<li>ASP.NET - <em>C#</em></li>
		<li>ASP.NET - <em>VB.NET</em></li>
		<li>PHP</li>
		<li>JSP</li>
		<li>ColdFusion</li>
		<li>Perl</li>
		<li>Python</li>
		<li>Ruby</li>
	</ul>
	<p>
		These samples can be found in appropriate folders of the evaluation package.</p>
</body>
</html>
