<%@ Page Language="vb" AutoEventWireup="false" Codebehind="UploadWithProgressBar.aspx.vb" Inherits="EAUploadExamples.UploadWithProgressBar"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Upload with progress bar</title>
<link rel="stylesheet" href="ExamplesStyle.css">
<script type="text/javascript" src="JSCore.js"></script>
<script type="text/javascript">
/* NOTE: Functions GetUploadId(), CreateProgressWindow()
are defined in JSCore.js file of EAUpload distribution package.*/
var progressWindow;
// Handles a button click, prepares for sending and submits a form.
function doUpload()
{
// Get an unique identifier that will be used by EAUploadModule
// for creating a new instance of Upload class.
// You should provide an UploadId for file processing page and
// for page that is used for retrieving a status information.
var UploadId = GetUploadId();
// Add an unique identifier to query string. EAUpload retrieves this value and
// uses it as an unique identifier of an Upload class instance. So, now we can get an access
// to required Upload object by this id from any page within the application.
// Function "RefreshQueryString" is defined in JSCore.js file.
document.Form1.action = RefreshQueryString(document.Form1.action, UploadId);
// Cretate a new window that will be used to display a status information.
progressWindow = CreateProgressWindow("UploadStatusInfo.aspx", UploadId, 570, 280);
if (window.stop || window.document.execCommand)
{
document.Form1.Upload.style.visibility = "hidden";
document.getElementById("cancelButton").style.visibility = "visible";
}
document.Form1.submit();
}
// Terminates an upload process
function cancelUpload()
{
if (window.stop)
{
window.stop();
}
else
{
window.document.execCommand("Stop");
}
if (progressWindow != undefined)
{
progressWindow.close();
}
document.Form1.Upload.style.visibility = "visible";
document.getElementById("cancelButton").style.visibility = "hidden";
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server" enctype="multipart/form-data">
This example demonstrates how to upload files to a web server and display a
status information of an upload process. A status information will be displayed
in the new window.
<br>
<br>
All uploaded files will be stored to the "UploadedFiles" folder that is located
in the root directory of an examples.<br>
You should grant write access to "UploadedFiles" folder to the ASP.NET process
identity(typically {MACHINE}\ASPNET on IIS 5<BR>
or Network Service on IIS 6).
<br>
<b>NOTE:</b> If you run this example on the local machine, select larg
files(greater than 100MB) to see a progress bar in action.
<br>
<br>
<table>
<tr>
<td>File 1:</td>
<td><input type="file" name="File_1" size="40"></td>
</tr>
<tr>
<td>File 2:</td>
<td><input type="file" name="File_2" size="40"></td>
</tr>
</table>
<br>
<input type="button" value="Upload" name="Upload" onclick="doUpload(); return false;">
<a id="cancelButton" onclick="cancelUpload()" style="VISIBILITY: hidden"><img src="images/cancel_button.gif" border="0"></a>
<br>
<br>
<asp:Label id="lblResponse" runat="server"></asp:Label>
</form>
<hr>
<a href="default.aspx" title="All examples">Other examples</a>
<p>
Used files: Bin\EasyAlgo.EAUpload.dll, web.config, UploadWithProgressBar.aspx,
UploadWithProgressBar.aspx.vb, UploadStatusInfo.aspx, UploadStatusInfo.aspx.vb,
JSCore.js, ExamplesStyle.css [Optional]
</p>
</body>
</HTML>