Uploadify文件上传插件
Uploadify简单说来,是基于Jquery的一款文件上传插件。它的功能特色总结如下:
- 支持单文件或多文件上传,可控制并发上传的文件数
- 在服务器端支持各种语言与之配合使用,诸如PHP,.NET,Java……
- 通过参数可配置上传文件类型及大小限制
- 通过参数可配置是否选择文件后自动上传
- 易于扩展,可控制每一步骤的回调函数(onSelect, onCancel……)
- 通过接口参数和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_ 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>