SWFUpload是一个客户端文件上传工具,最初由Vinterwebb.se开发,它通过整合flash与javascript技术为web开发者提供了一个具有丰富功能继而超越传统标签的文件上传模式。
0、请不要问“在不在”之类的问题,有问题直接问!1、学生或暂时没有工作的童鞋,整站资源免费下载!2、¥9.9充值终身VIP会员,加我微信,826096331 拉你进VIP群学习!3、程序员加油,技术改变世界。在线 充值
HTML
<span id="spanButtonPlaceholder"></span>
<div id="divFileProgressContainer"></div>
<div id="thumbnails">
<ul id="pic_list" style="margin: 5px;"></ul>
<div style="clear: both;"></div>
</div>
引入jQuery库和swfupload相关组件
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/swfupload.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<link href="css/default.css" rel="stylesheet" type="text/css" />
var swfu;
window.onload = function() {
swfu = new SWFUpload({
upload_url: "upload.php",
post_params: {
"PHPSESSID": "<?php echo session_id(); ?>"
},
file_size_limit: "2 MB",
file_types: "*.jpg;*.png;*.gif;*.bmp",
file_types_description: "JPG Images",
file_upload_limit: "100",
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_image_url: "images/upload.png",
button_placeholder_id: "spanButtonPlaceholder",
button_width: 113,
button_height: 33,
button_text: '',
button_text_style: '.spanButtonPlaceholder { font-family: Helvetica, Arial, sans-serif; font-size: 14pt;} ',
button_text_top_padding: 0,
button_text_left_padding: 0,
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND,
flash_url: "js/swfupload.swf",
custom_settings: {
upload_target: "divFileProgressContainer"
},
debug: false
});
};
swfupload相关API
参数 | 描述 | 默认值 |
swfu.selectFile | 一次选择单个文件. | - |
swfu.selectFiles(); | 一次选择多个文件. | - |
swfu.startUpload(); | 开始上传文件 | - |
swfu.cancelUpload(&quot;SWFUpload_0_0&quot;); | 取消正在上传,或将要上传的文件。SWFUpload_0_0表示第一个文件,SWFUpload_0_1表示第二个文件。。。。一直往后推。 | - |
swfu.stopUpload() | 停止文件的上传。 | - |
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群