当前位置: 代码迷 >> Web前端 >> 资料上传[Uploadify]
  详细解决方案

资料上传[Uploadify]

热度:676   发布时间:2013-09-28 10:01:20.0
文件上传[Uploadify]

Uploadify文件上传插件

Uploadify简单说来,是基于Jquery的一款文件上传插件。它的功能特色总结如下:

  1. 支持单文件或多文件上传,可控制并发上传的文件数
  2. 在服务器端支持各种语言与之配合使用,诸如PHP,.NET,Java……
  3. 通过参数可配置上传文件类型及大小限制
  4. 通过参数可配置是否选择文件后自动上传
  5. 易于扩展,可控制每一步骤的回调函数(onSelect, onCancel……)
  6. 通过接口参数和CSS控制外观

 http://www.uploadify.com/demos/

案例:http://demo.swfupload.org/v220/index.htm

代码截图:

<script type="text/javascript">
		var swfu;
		window.onload = function () {
			swfu = new SWFUpload({
				// Backend Settings
				upload_url: "upload.php",
				post_params: {"PHPSESSID": "4a5922ll546csgthmlpmogbvo7"},

				// File Upload Settings
				file_size_limit : "2 MB",	// 2MB
				file_types : "*.jpg",
				file_types_description : "JPG Images",
				file_upload_limit : "0",

				// Event Handler Settings - these functions as defined in Handlers.js
				//  The handlers are not part of SWFUpload but are part of my website and control how
				//  my website reacts to the SWFUpload events.
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,

				// Button Settings
				button_image_url : "images/SmallSpyGlassWithTransperancy_17x18.png",
				button_placeholder_id : "spanButtonPlaceholder",
				button_width: 180,
				button_height: 18,
				button_text : '<span class="button">Select Images <span class="buttonSmall">(2 MB Max)</span></span>',
				button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }',
				button_text_top_padding: 0,
				button_text_left_padding: 18,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				
				// Flash Settings
				flash_url : "../swfupload/swfupload.swf",

				custom_settings : {
					upload_target : "divFileProgressContainer"
				},
				
				// Debug Settings
				debug: false
			});
		};
	</script>