swfupload --forms改版

//index.php


<!DOCTYPE html>
<html>
<head>
<title>SWFUpload Demos - Classic Form Demo</title>
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/fileprogress.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
		var swfu;

		window.onload = function () {
			swfu = new SWFUpload({
				// Backend settings
				upload_url: "upload.php",
				file_post_name: "resume_file",

				// Flash file settings
				file_size_limit : "10 MB",
				file_types : "*.*",			// or you could use something like: "*.doc;*.wpd;*.pdf",
				file_types_description : "All Files",
				file_upload_limit : 0,
				file_queue_limit : 1,

				// Event handler settings
				swfupload_loaded_handler : swfUploadLoaded,

				file_dialog_start_handler: fileDialogStart,
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,

				//upload_start_handler : uploadStart,	// I could do some client/JavaScript validation here, but I don't need to.
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,

				// Button Settings
				button_image_url : "XPButtonUploadText_61x22.png",
				button_placeholder_id : "spanButtonPlaceholder",
				button_width: 61,
				button_height: 22,

				// Flash Settings
				flash_url : "../swfupload/swfupload.swf",
				flash9_url : "../swfupload/swfupload_fp9.swf",

				custom_settings : {
					progress_target : "fsUploadProgress",
					upload_successful : false
				},

				// Debug settings
				debug: false
			});

		};
	</script>
</head>
<body>
<div id="header">
	<h1 id="logo"><a href="../">SWFUpload</a></h1>
	<div id="version">v2.5.0</div>
</div>

<div id="content">

	<h2>Classic Form Demo</h2>
	<form id="form1" action="thanks.php" enctype="multipart/form-data" method="post">
		<p>This demo shows how SWFUpload might be combined with an HTML form.  It also demonstrates graceful degradation (using the graceful degradation plugin).
			This demo also demonstrates the use of the server_data parameter.  This demo requires Flash Player 9+</p>
		<div class="fieldset">
			<span class="legend">Submit your Application</span>
			<table style="vertical-align:top;">
				<tr>
					<td><label for="lastname">Last Name:</label></td>
					<td><input name="lastname" id="lastname" type="text" style="width: 200px" /></td>
				</tr>
				<tr>
					<td><label for="firstname">First Name:</label></td>
					<td><input name="firstname" id="firstname" type="text" style="width: 200px" /></td>
				</tr>
				<tr>
					<td><label for="education">Education:</label></td>
					<td><textarea name="education"  id="education" cols="0" rows="0" style="width: 400px; height: 100px;"></textarea></td>
				</tr>
				<tr>
					<td><label for="txtFileName">Resume:</label></td>
					<td>
						<div>
							<div>
								<input type="text" id="txtFileName" disabled="true" style="border: solid 1px; background-color: #FFFFFF;" />
								<span id="spanButtonPlaceholder"></span>
								(10 MB max)
							</div>
							<div class="flash" id="fsUploadProgress">
								<!-- This is where the file progress gets shown.  SWFUpload doesn't update the UI directly.
											The Handlers (in handlers.js) process the upload events and make the UI updates -->
							</div>
							<input type="hidden" name="hidFileID" id="hidFileID" value="" />
							<!-- This is where the file ID is stored after SWFUpload uploads the file and gets the ID back from upload.php -->
						</div>
					</td>
				</tr>
				<tr>
					<td><label for="references">References:</label></td>
					<td><textarea name="references" id="references" cols="0" rows="0" style="width: 400px; height: 100px;"></textarea></td>
				</tr>

				<tr>
					<td><label for="images">images:</label></td>
					<td><input type="file" name="images" id="images" /></td>
				</tr>

			</table>
			<br />
			<input type="submit" value="Submit Application" id="btnSubmit" />
		</div>
	</form>
</div>
</body>
</html>
//upload.php

<?php
	// The Demos don't save files

	if (isset($_FILES["resume_file"]) && is_uploaded_file($_FILES["resume_file"]["tmp_name"]) && $_FILES["resume_file"]["error"] == 0) {
		echo $_FILES["resume_file"]["name"];	// Create a pretend file id, this might have come from a database.
	}

	if (isset($_FILES["images"]) && is_uploaded_file($_FILES["images"]["tmp_name"]) && $_FILES["images"]["error"] == 0) {
		echo $_FILES["images"]["name"];	// Create a pretend file id, this might have come from a database.
	}

	$file_name = $_FILES["resume_file"]["name"];

	$file_name = mktime() . $file_name;

	if (!@move_uploaded_file($_FILES["resume_file"]["tmp_name"], $file_name)) {
		echo "文件无法保存.";
		exit(0);
	}else{
		echo "文件已经保存。";
	}

	exit(0);	// If there was an error we don't return anything and the webpage will have to deal with it.
?>

//thanks.php


<?php

// Check for a degraded file upload, this means SWFUpload did not load and the user used the standard HTML upload
$used_degraded = false;
$resume_id = "";
if (isset($_FILES["resume_degraded"]) && is_uploaded_file($_FILES["resume_degraded"]["tmp_name"]) && $_FILES["resume_degraded"]["error"] == 0) {
    $resume_id = $_FILES["resume_degraded"]["name"];

    $used_degraded = true;
}

if (isset($_FILES["images"]) && is_uploaded_file($_FILES["images"]["tmp_name"]) && $_FILES["images"]["error"] == 0) {
    $images_id = $_FILES["images"]["name"];

    $file = $_FILES["images"]["name"];
	//$file = mktime() . $file;
	echo $_FILES["images"]["name"];
	if(!@move_uploaded_file($_FILES["images"]["tmp_name"], $file))
	{
		echo "image no";
	}
	else {
		echo "image yes";
	}

    $used_degraded = true;
}

if (isset($_FILES["images"]) && is_uploaded_file($_FILES["images"]["tmp_name"]) && $_FILES["images"]["error"] == 0) {
    $images_size = $_FILES["images"]["size"];

    $used_degraded = true;
}

// Check for the file id we should have gotten from SWFUpload
if (isset($_POST["hidFileID"]) && $_POST["hidFileID"] != "" ) {
	$resume_id = $_POST["hidFileID"];
}

?>


<?php

	/*mysql_connect("localhost", "root", "zq19890319");
	mysql_select_db("swfupload");

	$file_name = $_FILES["resume_degraded"]['name'];

	$file_name = mktime() . $file_name;

	if (!@move_uploaded_file($_FILES["resume_degraded"]["tmp_name"], $save_path.$file_name)) {
		HandleError("文件无法保存.");
		exit(0);
	}else{
		mysql_query("insert into swfupload (id, video, num) values (NULL, '$file_name', $num)");
	}
	echo "File Received";
	exit(0);


function HandleError($message) {
	header("HTTP/1.1 500 Internal Server Error");
	echo $message;
}*/

?>



<!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>SWFUpload Demos - Classic Form Demo</title>
<link href="../css/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
	<h1 id="logo"><a href="../">SWFUpload</a></h1>
	<div id="version">v2.2.0</div>
</div>

<div id="content">

	<h2>Classic Form Demo</h2>
	<?php if ($resume_id == "") { ?>
		<p>Your resume was not received.</p>
	<?php } else { ?>
		<table>
			<tr>
				<td>Last Name: </td>
				<td><?php echo htmlspecialchars($_POST["lastname"]); ?> </td>
			</tr>
			<tr>
				<td>First Name: </td>
				<td><?php echo htmlspecialchars($_POST["firstname"]); ?> </td>
			</tr>
			<tr>
				<td>Education Name: </td>
				<td><?php echo htmlspecialchars($_POST["education"]); ?> </td>
			</tr>
			<tr>
				<td>Resume ID: </td>
				<td><?php echo htmlspecialchars($resume_id); ?> </td>
			</tr>
			<tr>
				<td>References: </td>
				<td><?php echo htmlspecialchars($_POST["references"]); ?> </td>
			</tr>

			<tr>
				<td>Images: </td>
				<td><?php echo htmlspecialchars($images_id); ?> </td>
			</tr>

			<tr>
				<td>Images: </td>
				<td><?php echo htmlspecialchars($images_size); ?> </td>
			</tr>

		</table>
		<?php
		if ($used_degraded) { ?>
		<p>You used the standard HTML form.</p>
		<?php } ?>
		<hr width="90%" />
		<p> Thank you for your submission. </p>
	<?php } ?>
	<p><a href="index.php">Submit another Application</a></p>
	<p> Thanks for trying this demo.  Your files are discarded for the purposes of this demo. </p>
</div>
</body>
</html>


1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看rEADME.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看rEADME.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值