<script type="text/javascript" src="/script/swfupload/swfupload.js"></script> <script type="text/javascript" src="/script/swfupload/swfupload.queue.js"></script> <script type="text/javascript" src="/script/swfupload/handlers.js"></script> var swfu = new SWFUpload({ upload_url: "http://www.aa.com/changeFile", // 文件上传 地址 post_params: {"name" : "huliang"}, // File Upload Settings file_size_limit : "10 MB",// 1000MB file_types : "*.doc;*.docx", file_types_description : "文档", file_upload_limit : "1", // 限制文件上传个数 为 1 file_queue_error_handler : fileQueueError, file_dialog_complete_handler : fileDialogComplete,//选择好文件后提交 // file_queued_handler : fileQuened, upload_progress_handler : uploadProgress, upload_error_handler : uploadError, upload_success_handler : uploadSuccess, upload_complete_handler : uploadComplete, button_action:SWFUpload.BUTTON_ACTION.SELECT_FILE, // Button Settings // button_image_url : "images/SmallSpyGlassWithTransperancy_17x18.png", button_placeholder_id : "uploadfile", button_width: 180, button_height: 18, button_text : '<span class="blue">上传</span>', button_text_style : '.blue{color:#0099cc;text-align:center;}', 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 : "/script/swfupload/swfupload.swf", custom_settings : { upload_target : "divFileProgressContainer" }, // Debug Settings debug: false //是否显示调试窗口 }); // 选择文件后,立即提交 function fileDialogComplete(){ swfu.startUpload(); } // 文件上传成功后,回调函数 function uploadSuccess(file, serverData){ alert(serverData); myalert(0,"上传成功",function(){ <span style="color:#ff0000;">var stats = swfu.getStats(); stats.successful_uploads = 0; swfu.setStats(stats);</span> }); } // 文件上传失败,回调函数 function uploadError(){ myalert(0,"上传失败"); swfu.cleanUp(); } <pre name="code" class="plain"><span style="color:#ff0000;">当上传 1 个文件后,还想在上传,就会报 文件太多的错误,解决方法如下: var stats = swfu.getStats(); stats.successful_uploads = 0; swfu.setStats(stats); 这样就可以无限制的上传了。。</span>
You have ettempted to queue to many files.You may select one files.
原文地址:http://blog.csdn.net/hukang00/article/details/44342371