当前位置: 首页 > 工具软件 > SWFUpload > 使用案例 >

SwfUpload基本配置

丁淇
2023-12-01
 
<!DOCTYPE html>
<html>
<head>
<title>SWFUpload Demos - Simple 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="../swfupload/swfupload.queue.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() {
			var settings = {


				//这里面的被始化都在 swfupload.js文件里面
				flash_url : "../swfupload/swfupload.swf",
				flash9_url : "../swfupload/swfupload_fp9.swf",
				upload_url: "upload.php",
				post_file_name:"filedata",	//相当于input type=upload name=filedata
				post_params: {"name" : "<?=mktime()?>"},//post 传递过去的值
				file_size_limit : "100 MB",
				file_types : "*.*;*.jpg;*.png",			//多个之间用 ; 分开
				file_types_description : "All Files",
				file_upload_limit : 100, 				//可以设置一个,用于普通的上传
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",   //自定义上传进度条的位置
					cancelButtonId : "btnCancel"			//定义停止上按钮的位置,两个都是用一个ID即可调用
				},
				debug: false,

				// Button settings
				button_image_url: "images/TestImageNoText_65x29.png",
				button_width: "65",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",//上传按钮的位置,也是一个ID
				button_text: '上传',							   //上传按钮的文件
				button_text_style: ".theFont { font-size: 16; }",//上传按键的样式
				button_text_left_padding: 12,
				button_text_top_padding: 3,
				// The event handler functions are defined in handlers.js
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);
	     };
	</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>Simple Demo</h2>
	<form id="form1" action="index.php" method="post" enctype="multipart/form-data">
		<p>This page demonstrates a simple usage of SWFUpload.  It uses the Queue Plugin to simplify uploading or cancelling all queued files.</p>

			<div class="fieldset flash" id="fsUploadProgress">
			<span class="legend">Upload Queue</span>
			</div>
		<div id="divStatus">0 Files Uploaded</div>
			<div>
				<span id="spanButtonPlaceHolder"></span>
				<input id="btnCancel" type="button" value="停止" οnclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
				<a href="insert.php">插入</a>
			</div>

	</form>
</div>
</body>
</html>

 类似资料: