首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Flash >

利用flash批量下传文件

2012-11-23 
利用flash批量上传文件可以同时上传多个文件;类似ajax无刷新上传可以显示上传进度文件过滤功能swfupload.q

利用flash批量上传文件
可以同时上传多个文件;类似ajax无刷新上传可以显示上传进度文件过滤功能

swfupload.queue.js

/*Queue Plug-inFeatures:*Adds a cancelQueue() method for cancelling the entire queue.*All queued files are uploaded when startUpload() is called.*If false is returned from uploadComplete then the queue upload is stopped. If false is not returned (strict comparison) then the queue upload is continued.*Adds a QueueComplete event that is fired when all the queued files have finished uploading. Set the event handler with the queue_complete_handler setting.*///rock?修改版//lanshikun2008@163.comvar SWFUpload;if (typeof(SWFUpload) === "function") {SWFUpload.queue = {};SWFUpload.prototype.initSettings = (function (oldInitSettings) {return function () {if (typeof(oldInitSettings) === "function") {oldInitSettings.call(this);}this.customSettings.queue_cancelled_flag = false;this.customSettings.queue_upload_count = 0;this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;};})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload = function (fileID) {this.customSettings.queue_cancelled_flag = false;this.callFlash("StartUpload", false, [fileID]);};SWFUpload.prototype.cancelQueue = function () {this.customSettings.queue_cancelled_flag = true;this.stopUpload();var stats = this.getStats();clearAFile();while (stats.files_queued > 0) {this.cancelUpload();stats = this.getStats();}$('startUpload').disabled='disabled';};SWFUpload.queue.uploadCompleteHandler = function (file) {var user_upload_complete_handler = this.settings.user_upload_complete_handler;var continueUpload;if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {this.customSettings.queue_upload_count++;}if (typeof(user_upload_complete_handler) === "function") {continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;} else {continueUpload = true;}if (continueUpload) {var stats = this.getStats();if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {this.startUpload();} else if (this.customSettings.queue_cancelled_flag === false) {this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);this.customSettings.queue_upload_count = 0;} else {this.customSettings.queue_cancelled_flag = false;this.customSettings.queue_upload_count = 0;}}};}

?

1 楼 snidt 2008-12-08   听上去不错
下来看看 2 楼 FengShen_Xia 2008-12-12   snidt 写道听上去不错
下来看看

热点排行