<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r" />
<title>Multiple files upload.</title>
<meta CONTENT="flash file upload, upload multiple files, flash upload control" NAME="keywords" />
<style type="text/css">
#responseContainer
{
overflow: auto;
width: 390px;
height: 250px;
border: 1px solid #cccccc;
}
</style>
<!-- Embedding the EAFlashUpload control -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var params = {
BGcolor: "#ffffff",
wmode: "window"
};
// id and name attribute may contain any value.
// You need to use specified below identifier to access to the EAFlashUpload methods and properties.
var attributes = {
id: "FlashUploader",
name: "FlashUploader"
};
var flashvars = new Object();
flashvars["uploader.uploadUrl"] = "uploaddescriptions.aspx"; // you should specify an appropriate URL of script that will receive files.
flashvars["viewFile"] = "TableView.swf";
// Specify form name for parsing
flashvars["uploader.formToSend"] = "Form1";
// define custom file property
flashvars["customFileProperties.public"] = "Description:put a description";
// set data source for custom column
flashvars["view.filesList.customColumn.propertyNameDataSource"] = "Description";
flashvars["view.filesList.customColumn.visible"] = true;
// hide size column and change file name pattern for displaying size
flashvars["queue.fileNamePattern"] = "#FILE_NAME# (#FILE_SIZE#)";
flashvars["view.filesList.sizeColumn.visible"] = false;
flashvars["view.filesList.nameColumn.width"] = 280;
flashvars["view.filesList.statusColumn.width"] = 50;
swfobject.embedSWF("EAFUpload.swf", "EAFlashUpload_holder", "450", "350", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
// Handles EAFlashUpload's onMovieLoad event and displays existing loading errors.
function FlashUploader_onMovieLoad(errors)
{
if(errors != "")
alert(errors);
}
function FlashUploader_onUploadStart()
{
FlashUploader.setProperty("uploader.formToSend", "Form1");
}
function FlashUploader_onFileLoadEnd(fileObj)
{
if(!document.getElementById("eachfile").checked)
{
FlashUploader.setProperty("uploader.formToSend", "");
}
var htmlCode = fileObj.serverResponse;
var rContainer = document.getElementById("responseContainer");
rContainer.innerHTML += htmlCode;
}
function clearList()
{
var rContainer = document.getElementById("responseContainer");
rContainer.innerHTML = "";
}
</script>
</head>
<body>
<p>
This example demonstrates how to add a custom property for files, display it as a custom column and send its value to the server. Here we define "Description" custom property for demonstration purpose. Actually the name can be any. Also this example demostrates how EAFlashUpload parses form and sends values to the server (values can be sent with the first file or with each file).
</p>
<div style="border: 1px solid #000000; padding: 10px;">
<b>Note:</b> Trial version has two limitiations: maximum files count is 10 and size of each file cannot be larger than 50 MB.
</div>
<br /><br />
<input type="checkbox" name="eachfile" id="eachfile" /> Check if form fields should be sent with each file
<br /><br />
<form name="Form1" >
<table>
<tr>
<td colspan="2">
Some menu:
<select name="menu" style="width: 100px;">
<option value="item1" selected="selected">Item 1</option>
<option value="item2">Item 2</option>
<option value="item3">Item 3</option>
<option value="item4">Item 4</option>
</select>
Author:
<input type="text" name="author" value="type an author's name" />
<p>
You can use Request.Form["field name"] object for ASP.NET or $_REQUEST["field name"] for PHP to retrieve values on the server side.
</p>
<br />
</td>
</tr>
<tr>
<td>
<div id="EAFlashUpload_holder">
You need at least Adobe Flash Player 10 for successful work. Download the latest version from here:
<br />
<a href="http://www.adobe.com/support/flashplayer/downloads.html">Adobe Flash Player</a>
</div>
</td>
<td style="padding-left: 40px; vertical-align: top;">
Server response:<br />
<div id="responseContainer"></div>
<a href="javascript:clearList();">Clear list</a>
</td>
</tr>
</table>
</form>
<br />
<hr />
<a target="_blank" href="http://www.easyalgo.com/quickstart/util/srcview.aspx?path=/Examples/EAFlashUpload/UploadDescription.src">View source code</a>
</body>
</html>