<html>
	<head>
		<title>Pure File Uploader</title>
<link href="../upload/ajaxfileupload.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="../upload/jquery.js"></script>
	<script type="text/javascript" src="../upload/ajaxfileupload.js"></script>
	<script type="text/javascript">
	window.returnValue= "Please Refresh Current Page To View The Result!";//这是子窗品的返回值
	function ajaxFileUpload()
	{
		var tbID = document.getElementById("tbID").value;
		var type = document.getElementById("type").value;
		var client = document.getElementById("client").value;
		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		$.ajaxFileUpload
		(
			{
				url:'doajaxfileupload.php?tbID='+tbID+'&type='+type+'&client='+client,
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'json',
				data:{name:'logan', id:'id'},
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							alert(data.error);
						}else
						{
							alert(data.msg);
							window.close();
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)
		
		return false;

	}
	</script>
	<?php 
	$tbID=!empty($_GET['tbID']) ? intval($_GET['tbID']) : ''; 
	$type=!empty($_GET['type']) ? $_GET['type'] : ''; 
	$client=!empty($_GET['client']) ? $_GET['client'] : ''; 
	?>	
	</head>

	<body>
    <div id="wrapper">
    <div id="content">
    	<h1>Pure File Upload Form</h1>
    	<p>Pure File Uploader  - upload your files with only one input field,Please be note when you uploading a file:</p>
				<ul>
					<li>Max filesize is 2MB</li>
					<li>The file type is only jpg,gif,png.</li>
					<li>If any problem please contact admin.</li>
				</ul>    	
		<img id="loading" src="../upload/loading.gif" style="display:none;">
		<form name="form" action="" method="POST" enctype="multipart/form-data">
		<table cellpadding="0" cellspacing="0" class="tableForm">

		<thead>
			<tr>
				<th>Please select a file and click Upload button<input name="tbID" id="tbID" value="<?php echo $tbID;?>" type="hidden"><input name="type" id="type" value="<?php echo $type;?>" type="hidden"><input name="client" id="client" value="<?php echo $client;?>" type="hidden"></th>
			</tr>
		</thead>
		<tbody>	
			<tr>
				<td><input id="fileToUpload" type="file" size="45" name="fileToUpload" class="input"></td>			</tr>
		</tbody>
			<tfoot>
				<tr>
					<td><button class="button" id="buttonUpload" onClick="return ajaxFileUpload();">Upload</button></td>
				</tr>
			</tfoot>
	</table>
	  </form>    	
    </div>
    </div>
	</body>
</html>