jquery-uploadifyv3.2.1 文件上传插件 学习
生活随笔
收集整理的這篇文章主要介紹了
jquery-uploadifyv3.2.1 文件上传插件 学习
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
先認識一下他的屬性。
?
var settings = $.extend({// Required Settings,這3個必須的咯。id : $this.attr('id'), // The ID of the DOM object,IDswf : 'uploadify.swf', // SWF file 路徑 uploader : 'uploadify.php', // 服務器處理路徑// Options,下面是可設置的屬性auto : true, // Automatically upload files when// added to the queue,是否添加以后就自動上傳。buttonClass : '', // A class name to add to the// browse button DOM objectbuttonCursor : 'hand', // The cursor to use with// the browse buttonbuttonImage : null, // (String or null) The path to// an image to use for the Flash// browse button if not using// CSS to style the buttonbuttonText : 'SELECT FILES', // The text to use// for the browse// button 文件上傳的名字checkExisting : false, // The path to a server-side// script that checks for// existing files on the// server,判斷是否已存在相應文件debug : false, // Turn on swfUpload debugging modefileObjName : 'Filedata', // The name of the file// object to use in your// server-side script,對應request的name是什么 **fileSizeLimit : 0, // The maximum size of an// uploadable file in KB// (Accepts units B KB MB GB if// string, 0 for no limit) 文件大小限制,0表示不限制。fileTypeDesc : 'All Files', // The description for// file types in the// browse dialog 文件描述fileTypeExts : '*.*', // Allowed extensions in the// browse dialog// (server-side validation// should also be used),允許的擴展類型height : 30, // The height of the browse button,按鈕高度itemTemplate : false, // The template for the file// item in the queuemethod : 'post', // The method to use when// sending files to the// server-side upload script,提交方法,默認為postmulti : true, // Allow multiple file selection in// the browse dialog,是否允許多文件選擇,默認為trueformData : {}, // An object with additional data to// send to the server-side upload// script with every file uploadpreventCaching : true, // Adds a random value to// the Flash URL to prevent// caching of it (conflicts// with existing parameters)progressData : 'percentage', // ('percentage' or// 'speed') Data to// show in the queue// item during a// file uploadqueueID : false, // The ID of the DOM object to// use as a file queue (without// the #),文件隊列。queueSizeLimit : 999, // The maximum number of// files that can be in the// queue at one timeremoveCompleted : true, // Remove queue items from// the queue when they are// done uploading,完成以后自動移除。removeTimeout : 3, // The delay in seconds before// removing a queue item if// removeCompleted is set to// true,移出的時間requeueErrors : false, // Keep errored files in the// queue and keep trying to// upload them,保持錯誤的文件在隊列里面,并可以重新上傳successTimeout : 30, // The number of seconds to// wait for Flash to detect// the server's response// after the file has// finished uploading,完成以后等待服務器30秒uploadLimit : 0, // The maximum number of files// you can upload,上傳限制。width : 120, // The width of the browse button,按鈕寬度// Events,重載的事件,不重載的話,則會執行自己的再執行原生的 overrideEvents : []}, options);2.接著是他的事件
onCancel :function(file){}//取消方法 onClearQueue onDestroy onDialogClose onDialogOpen onDisable onEnable onFallback onInit onQueueComplete onSelect onSelectError onSWFReady//上傳完成 onUploadComplete: function(file) {alert('The file ' + file.name + ' finished processing.');?} onUploadError onUploadProgress onUploadStart onUploadSuccess
方法:
$('#file_upload').uploadify('cancel',"*"); // 有*的話,則隊列里的所有會// 刪掉或上傳,沒有則作用于// 第一個 $('#file_upload').uploadify('upload','*'); $('#file_upload').uploadify('stop'); $('#file_upload').uploadify('settings','buttonText','BROWSE'); $('#file_upload').uploadify('disable', true); // true - disable,false - enable $('#file_upload').uploadify('destroy');?
轉載于:https://www.cnblogs.com/cycxtz/p/6017327.html
超強干貨來襲 云風專訪:近40年碼齡,通宵達旦的技術人生總結
以上是生活随笔為你收集整理的jquery-uploadifyv3.2.1 文件上传插件 学习的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 布局方式
- 下一篇: 【NOIP普及组】2016模拟考试(10