(function($){ varMethods ={init:function(options) {return This. each (function(){ var$ This= $( This); var$clone = $ This. Clone (); varSettings =$.extend ({ID: $ This. attr (' id '), button:$ This, uploader:‘‘, formdata:{}, Auto:true, FileTypes:‘*.*‘, Multi:true, Filesizelimit:0, Queuesizelimit:1, Onuploadstart:function(FileManager) {return true;},//action at the beginning of the uploadOnuploadsuccess:function(FileManager, response) {},//Upload a successful actionOnuploadcomplete:function(FileManager) {},//upload the completed actionOnuploaderror:function(FileManager, response) {},//Upload failed actionOnProgress:function(FileManager, Loaded, total) {},//Upload ProgressOnInit:function(){},//the action at initialization time //beforeupload:function () {},//Before starting upload execution},options); This. _uploader =NewH5uploader.uploader (settings); }); } }; $.fn.html5uploader=function(method) {if(Methods[method]) {returnMethods[method].apply ( This, Array.prototype.slice.call (arguments, 1)); } Else if(typeofmethod = = = ' object ' | | !method) { returnMethods.init.apply ( This, arguments); } Else{$.error (' The method ' + method + ' does not exist in $.html5uploader '); } }; }) (jQuery);
Full Script (Extract code: a088)
HTML5 image uploading control based on jquery imitation uploadify jquery.html5uploader