diff --git a/.gitignore b/.gitignore index 3b58c6f1..48ae2054 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ Thumbs.db classes/ ._* /node_modules -*.jar \ No newline at end of file +*.jar +release.sh diff --git a/demo/war/index.html b/demo/war/index.html index 7e45a121..cd7c69a4 100644 --- a/demo/war/index.html +++ b/demo/war/index.html @@ -80,6 +80,9 @@

myModel: model object to be sent with the file.
choose a single file: + + +
or multiple files:      
diff --git a/demo/war/js/angular-file-upload-shim.js b/demo/war/js/angular-file-upload-shim.js index eae36374..ca5b0299 100644 --- a/demo/war/js/angular-file-upload-shim.js +++ b/demo/war/js/angular-file-upload-shim.js @@ -10,7 +10,7 @@ var hasFlash = function() { var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); if (fo) return true; } catch(e) { - if (navigator.mimeTypes["application/x-shockwave-flash"] != undefined) return true; + if (navigator.mimeTypes['application/x-shockwave-flash'] != undefined) return true; } return false; } @@ -22,7 +22,7 @@ var patchXHR = function(fnName, newFn) { if (window.XMLHttpRequest) { if (window.FormData && (!window.FileAPI || !FileAPI.forceLoad)) { // allow access to Angular XHR private field: https://github.com/angular/angular.js/issues/1934 - patchXHR("setRequestHeader", function(orig) { + patchXHR('setRequestHeader', function(orig) { return function(header, value) { if (header === '__setXHR_') { var val = value(this); @@ -48,7 +48,7 @@ if (window.XMLHttpRequest) { } } - patchXHR("open", function(orig) { + patchXHR('open', function(orig) { return function(m, url, b) { initializeUploadListener(this); this.__url = url; @@ -62,25 +62,25 @@ if (window.XMLHttpRequest) { } }); - patchXHR("getResponseHeader", function(orig) { + patchXHR('getResponseHeader', function(orig) { return function(h) { return this.__fileApiXHR && this.__fileApiXHR.getResponseHeader ? this.__fileApiXHR.getResponseHeader(h) : (orig == null ? null : orig.apply(this, [h])); }; }); - patchXHR("getAllResponseHeaders", function(orig) { + patchXHR('getAllResponseHeaders', function(orig) { return function() { return this.__fileApiXHR && this.__fileApiXHR.getAllResponseHeaders ? this.__fileApiXHR.getAllResponseHeaders() : (orig == null ? null : orig.apply(this)); } }); - patchXHR("abort", function(orig) { + patchXHR('abort', function(orig) { return function() { return this.__fileApiXHR && this.__fileApiXHR.abort ? this.__fileApiXHR.abort() : (orig == null ? null : orig.apply(this)); } }); - patchXHR("setRequestHeader", function(orig) { + patchXHR('setRequestHeader', function(orig) { return function(header, value) { if (header === '__setXHR_') { initializeUploadListener(this); @@ -97,7 +97,7 @@ if (window.XMLHttpRequest) { } }); - patchXHR("send", function(orig) { + patchXHR('send', function(orig) { return function() { var xhr = this; if (arguments[0] && arguments[0].__isShim) { @@ -138,7 +138,7 @@ if (window.XMLHttpRequest) { xhr.getAllResponseHeaders = function(){}; _this.complete(null, {status: 204, statusText: 'No Content'}); } - }, 5000); + }, 10000); } }, headers: xhr.__requestHeaders @@ -187,6 +187,14 @@ if (!window.FormData || (window.FileAPI && FileAPI.forceLoad)) { wrap.appendChild(elem); } else { el.addClass('js-fileapi-wrapper'); + if (el.parent()[0].__file_click_fn_delegate_) { + if (el.parent().css('position') === '' || el.parent().css('position') === 'static') { + el.parent().css('position', 'relative'); + } + el.css('top', 0).css('bottom', 0).css('left', 0).css('right', 0).css('width', '100%').css('height', '100%'). + css('padding', 0).css('margin', 0); + el.parent().unbind('click', el.parent()[0].__file_click_fn_delegate_); + } } } } @@ -236,7 +244,7 @@ if (!window.FormData || (window.FileAPI && FileAPI.forceLoad)) { addFlash(this); if (window.jQuery) { // fix for #281 jQuery on IE8 - angular.element(this).bind("change", changeFnWrapper(null)); + angular.element(this).bind('change', changeFnWrapper(null)); } else { origAttachEvent.apply(this, [e, changeFnWrapper(fn)]); } @@ -291,7 +299,7 @@ if (!window.FormData || (window.FileAPI && FileAPI.forceLoad)) { } if (FileAPI.staticPath == null) FileAPI.staticPath = basePath; - script.setAttribute('src', jsUrl || basePath + "FileAPI.min.js"); + script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js'); document.getElementsByTagName('head')[0].appendChild(script); FileAPI.hasFlash = hasFlash(); } diff --git a/demo/war/js/angular-file-upload.js b/demo/war/js/angular-file-upload.js index 6fcb0408..34fd356d 100644 --- a/demo/war/js/angular-file-upload.js +++ b/demo/war/js/angular-file-upload.js @@ -145,24 +145,34 @@ angularFileUpload.directive('ngFileSelect', [ '$parse', '$timeout', function($pa var fn = $parse(attr['ngFileSelect']); if (elem[0].tagName.toLowerCase() !== 'input' || (elem.attr('type') && elem.attr('type').toLowerCase()) !== 'file') { var fileElem = angular.element('') - for (var i = 0; i < elem[0].attributes.length; i++) { - fileElem.attr(elem[0].attributes[i].name, elem[0].attributes[i].value); + var attrs = elem[0].attributes; + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].name.toLowerCase() !== 'type') { + fileElem.attr(attrs[i].name, attrs[i].value); + } } if (attr["multiple"]) fileElem.attr("multiple", "true"); - fileElem.css("top", 0).css("bottom", 0).css("left", 0).css("right", 0).css("width", "100%"). - css("opacity", 0).css("position", "absolute").css('filter', 'alpha(opacity=0)').css("padding", 0); + fileElem.css("width", "1px").css("height", "1px").css("opacity", 0).css("position", "absolute").css('filter', 'alpha(opacity=0)'); + fileElem.attr('__wrapper_for_parent_', true); + +// fileElem.css("top", 0).css("bottom", 0).css("left", 0).css("right", 0).css("width", "100%"). +// css("opacity", 0).css("position", "absolute").css('filter', 'alpha(opacity=0)').css("padding", 0).css("margin", 0); elem.append(fileElem); + elem[0].__file_click_fn_delegate_ = function() { + fileElem[0].click(); + }; + elem.bind('click', elem[0].__file_click_fn_delegate_); elem.css("overflow", "hidden"); - if (fileElem.parent()[0] != elem[0]) { - //fix #298 button element - elem.wrap(''); - elem.css("z-index", "-1000") - elem.parent().append(fileElem); - elem = elem.parent(); - } - if (elem.css("position") === '' || elem.css("position") === 'static') { - elem.css("position", "relative"); - } +// if (fileElem.parent()[0] != elem[0]) { +// //fix #298 button element +// elem.wrap(''); +// elem.css("z-index", "-1000") +// elem.parent().append(fileElem); +// elem = elem.parent(); +// } +// if (elem.css("position") === '' || elem.css("position") === 'static') { +// elem.css("position", "relative"); +// } elem = fileElem; } elem.bind('change', function(evt) { diff --git a/dist/angular-file-upload-shim.js b/dist/angular-file-upload-shim.js index 6072408b..f47118a0 100644 --- a/dist/angular-file-upload-shim.js +++ b/dist/angular-file-upload-shim.js @@ -10,7 +10,7 @@ var hasFlash = function() { var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); if (fo) return true; } catch(e) { - if (navigator.mimeTypes["application/x-shockwave-flash"] != undefined) return true; + if (navigator.mimeTypes['application/x-shockwave-flash'] != undefined) return true; } return false; } @@ -22,7 +22,7 @@ var patchXHR = function(fnName, newFn) { if (window.XMLHttpRequest) { if (window.FormData && (!window.FileAPI || !FileAPI.forceLoad)) { // allow access to Angular XHR private field: https://github.com/angular/angular.js/issues/1934 - patchXHR("setRequestHeader", function(orig) { + patchXHR('setRequestHeader', function(orig) { return function(header, value) { if (header === '__setXHR_') { var val = value(this); @@ -48,7 +48,7 @@ if (window.XMLHttpRequest) { } } - patchXHR("open", function(orig) { + patchXHR('open', function(orig) { return function(m, url, b) { initializeUploadListener(this); this.__url = url; @@ -62,25 +62,25 @@ if (window.XMLHttpRequest) { } }); - patchXHR("getResponseHeader", function(orig) { + patchXHR('getResponseHeader', function(orig) { return function(h) { return this.__fileApiXHR && this.__fileApiXHR.getResponseHeader ? this.__fileApiXHR.getResponseHeader(h) : (orig == null ? null : orig.apply(this, [h])); }; }); - patchXHR("getAllResponseHeaders", function(orig) { + patchXHR('getAllResponseHeaders', function(orig) { return function() { return this.__fileApiXHR && this.__fileApiXHR.getAllResponseHeaders ? this.__fileApiXHR.getAllResponseHeaders() : (orig == null ? null : orig.apply(this)); } }); - patchXHR("abort", function(orig) { + patchXHR('abort', function(orig) { return function() { return this.__fileApiXHR && this.__fileApiXHR.abort ? this.__fileApiXHR.abort() : (orig == null ? null : orig.apply(this)); } }); - patchXHR("setRequestHeader", function(orig) { + patchXHR('setRequestHeader', function(orig) { return function(header, value) { if (header === '__setXHR_') { initializeUploadListener(this); @@ -97,7 +97,7 @@ if (window.XMLHttpRequest) { } }); - patchXHR("send", function(orig) { + patchXHR('send', function(orig) { return function() { var xhr = this; if (arguments[0] && arguments[0].__isShim) { @@ -138,7 +138,7 @@ if (window.XMLHttpRequest) { xhr.getAllResponseHeaders = function(){}; _this.complete(null, {status: 204, statusText: 'No Content'}); } - }, 5000); + }, 10000); } }, headers: xhr.__requestHeaders @@ -187,6 +187,14 @@ if (!window.FormData || (window.FileAPI && FileAPI.forceLoad)) { wrap.appendChild(elem); } else { el.addClass('js-fileapi-wrapper'); + if (el.parent()[0].__file_click_fn_delegate_) { + if (el.parent().css('position') === '' || el.parent().css('position') === 'static') { + el.parent().css('position', 'relative'); + } + el.css('top', 0).css('bottom', 0).css('left', 0).css('right', 0).css('width', '100%').css('height', '100%'). + css('padding', 0).css('margin', 0); + el.parent().unbind('click', el.parent()[0].__file_click_fn_delegate_); + } } } } @@ -236,7 +244,7 @@ if (!window.FormData || (window.FileAPI && FileAPI.forceLoad)) { addFlash(this); if (window.jQuery) { // fix for #281 jQuery on IE8 - angular.element(this).bind("change", changeFnWrapper(null)); + angular.element(this).bind('change', changeFnWrapper(null)); } else { origAttachEvent.apply(this, [e, changeFnWrapper(fn)]); } @@ -291,7 +299,7 @@ if (!window.FormData || (window.FileAPI && FileAPI.forceLoad)) { } if (FileAPI.staticPath == null) FileAPI.staticPath = basePath; - script.setAttribute('src', jsUrl || basePath + "FileAPI.min.js"); + script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js'); document.getElementsByTagName('head')[0].appendChild(script); FileAPI.hasFlash = hasFlash(); } diff --git a/dist/angular-file-upload-shim.min.js b/dist/angular-file-upload-shim.min.js index 5fce32f9..95d0188f 100644 --- a/dist/angular-file-upload-shim.min.js +++ b/dist/angular-file-upload-shim.min.js @@ -1,2 +1,2 @@ /*! 1.6.9 */ -!function(){var a=function(){try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(a)return!0}catch(b){if(void 0!=navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1},b=function(a,b){window.XMLHttpRequest.prototype[a]=b(window.XMLHttpRequest.prototype[a])};if(window.XMLHttpRequest){if(!window.FormData||window.FileAPI&&FileAPI.forceLoad){var c=function(a){if(!a.__listeners){a.upload||(a.upload={}),a.__listeners=[];var b=a.upload.addEventListener;a.upload.addEventListener=function(c,d){a.__listeners[c]=d,b&&b.apply(this,arguments)}}};b("open",function(a){return function(b,d,e){c(this),this.__url=d;try{a.apply(this,[b,d,e])}catch(f){f.message.indexOf("Access is denied")>-1&&a.apply(this,[b,"_fix_for_ie_crossdomain__",e])}}}),b("getResponseHeader",function(a){return function(b){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(b):null==a?null:a.apply(this,[b])}}),b("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==a?null:a.apply(this)}}),b("abort",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),b("setRequestHeader",function(a){return function(b,d){if("__setXHR_"===b){c(this);var e=d(this);e instanceof Function&&e(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[b]=d,a.apply(this,arguments)}}),b("send",function(b){return function(){var c=this;if(arguments[0]&&arguments[0].__isShim){var d=arguments[0],e={url:c.__url,jsonp:!1,cache:!0,complete:function(a,b){c.__completed=!0,!a&&c.__listeners.load&&c.__listeners.load({type:"load",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),!a&&c.__listeners.loadend&&c.__listeners.loadend({type:"loadend",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),"abort"===a&&c.__listeners.abort&&c.__listeners.abort({type:"abort",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),void 0!==b.status&&Object.defineProperty(c,"status",{get:function(){return 0==b.status&&a&&"abort"!==a?500:b.status}}),void 0!==b.statusText&&Object.defineProperty(c,"statusText",{get:function(){return b.statusText}}),Object.defineProperty(c,"readyState",{get:function(){return 4}}),void 0!==b.response&&Object.defineProperty(c,"response",{get:function(){return b.response}});var d=b.responseText||(a&&0==b.status&&"abort"!==a?a:void 0);Object.defineProperty(c,"responseText",{get:function(){return d}}),Object.defineProperty(c,"response",{get:function(){return d}}),a&&Object.defineProperty(c,"err",{get:function(){return a}}),c.__fileApiXHR=b,c.onreadystatechange&&c.onreadystatechange()},fileprogress:function(a){if(a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded,a.total===a.loaded){var b=this;setTimeout(function(){c.__completed||(c.getAllResponseHeaders=function(){},b.complete(null,{status:204,statusText:"No Content"}))},5e3)}},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f
',d=d.firstChild;var e=b.parentNode;e.insertBefore(d,b),e.removeChild(b),d.appendChild(b)}else c.addClass("js-fileapi-wrapper")},e=function(a){return function(b){for(var c=FileAPI.getFiles(b),d=0;d-1){c=f.substring(0,e);break}null==FileAPI.staticPath&&(FileAPI.staticPath=c),g.setAttribute("src",b||c+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(g),FileAPI.hasFlash=a()}}(),FileAPI.disableFileInput=function(a,b){b?a.removeClass("js-fileapi-wrapper"):a.addClass("js-fileapi-wrapper")}}window.FileReader||(window.FileReader=function(){var a=this,b=!1;this.listeners={},this.addEventListener=function(b,c){a.listeners[b]=a.listeners[b]||[],a.listeners[b].push(c)},this.removeEventListener=function(b,c){a.listeners[b]&&a.listeners[b].splice(a.listeners[b].indexOf(c),1)},this.dispatchEvent=function(b){var c=a.listeners[b.type];if(c)for(var d=0;d-1&&a.apply(this,[b,"_fix_for_ie_crossdomain__",e])}}}),b("getResponseHeader",function(a){return function(b){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(b):null==a?null:a.apply(this,[b])}}),b("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==a?null:a.apply(this)}}),b("abort",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),b("setRequestHeader",function(a){return function(b,d){if("__setXHR_"===b){c(this);var e=d(this);e instanceof Function&&e(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[b]=d,a.apply(this,arguments)}}),b("send",function(b){return function(){var c=this;if(arguments[0]&&arguments[0].__isShim){var d=arguments[0],e={url:c.__url,jsonp:!1,cache:!0,complete:function(a,b){c.__completed=!0,!a&&c.__listeners.load&&c.__listeners.load({type:"load",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),!a&&c.__listeners.loadend&&c.__listeners.loadend({type:"loadend",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),"abort"===a&&c.__listeners.abort&&c.__listeners.abort({type:"abort",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),void 0!==b.status&&Object.defineProperty(c,"status",{get:function(){return 0==b.status&&a&&"abort"!==a?500:b.status}}),void 0!==b.statusText&&Object.defineProperty(c,"statusText",{get:function(){return b.statusText}}),Object.defineProperty(c,"readyState",{get:function(){return 4}}),void 0!==b.response&&Object.defineProperty(c,"response",{get:function(){return b.response}});var d=b.responseText||(a&&0==b.status&&"abort"!==a?a:void 0);Object.defineProperty(c,"responseText",{get:function(){return d}}),Object.defineProperty(c,"response",{get:function(){return d}}),a&&Object.defineProperty(c,"err",{get:function(){return a}}),c.__fileApiXHR=b,c.onreadystatechange&&c.onreadystatechange()},fileprogress:function(a){if(a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded,a.total===a.loaded){var b=this;setTimeout(function(){c.__completed||(c.getAllResponseHeaders=function(){},b.complete(null,{status:204,statusText:"No Content"}))},1e4)}},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f',d=d.firstChild;var e=b.parentNode;e.insertBefore(d,b),e.removeChild(b),d.appendChild(b)}else c.addClass("js-fileapi-wrapper"),c.parent()[0].__file_click_fn_delegate_&&((""===c.parent().css("position")||"static"===c.parent().css("position"))&&c.parent().css("position","relative"),c.css("top",0).css("bottom",0).css("left",0).css("right",0).css("width","100%").css("height","100%").css("padding",0).css("margin",0),c.parent().unbind("click",c.parent()[0].__file_click_fn_delegate_))},e=function(a){return function(b){for(var c=FileAPI.getFiles(b),d=0;d-1){c=f.substring(0,e);break}null==FileAPI.staticPath&&(FileAPI.staticPath=c),g.setAttribute("src",b||c+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(g),FileAPI.hasFlash=a()}}(),FileAPI.disableFileInput=function(a,b){b?a.removeClass("js-fileapi-wrapper"):a.addClass("js-fileapi-wrapper")}}window.FileReader||(window.FileReader=function(){var a=this,b=!1;this.listeners={},this.addEventListener=function(b,c){a.listeners[b]=a.listeners[b]||[],a.listeners[b].push(c)},this.removeEventListener=function(b,c){a.listeners[b]&&a.listeners[b].splice(a.listeners[b].indexOf(c),1)},this.dispatchEvent=function(b){var c=a.listeners[b.type];if(c)for(var d=0;d') - for (var i = 0; i < elem[0].attributes.length; i++) { - fileElem.attr(elem[0].attributes[i].name, elem[0].attributes[i].value); + var attrs = elem[0].attributes; + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].name.toLowerCase() !== 'type') { + fileElem.attr(attrs[i].name, attrs[i].value); + } } if (attr["multiple"]) fileElem.attr("multiple", "true"); - fileElem.css("top", 0).css("bottom", 0).css("left", 0).css("right", 0).css("width", "100%"). - css("opacity", 0).css("position", "absolute").css('filter', 'alpha(opacity=0)').css("padding", 0); + fileElem.css("width", "1px").css("height", "1px").css("opacity", 0).css("position", "absolute").css('filter', 'alpha(opacity=0)'); + fileElem.attr('__wrapper_for_parent_', true); + +// fileElem.css("top", 0).css("bottom", 0).css("left", 0).css("right", 0).css("width", "100%"). +// css("opacity", 0).css("position", "absolute").css('filter', 'alpha(opacity=0)').css("padding", 0).css("margin", 0); elem.append(fileElem); + elem[0].__file_click_fn_delegate_ = function() { + fileElem[0].click(); + }; + elem.bind('click', elem[0].__file_click_fn_delegate_); elem.css("overflow", "hidden"); - if (fileElem.parent()[0] != elem[0]) { - //fix #298 button element - elem.wrap(''); - elem.css("z-index", "-1000") - elem.parent().append(fileElem); - elem = elem.parent(); - } - if (elem.css("position") === '' || elem.css("position") === 'static') { - elem.css("position", "relative"); - } +// if (fileElem.parent()[0] != elem[0]) { +// //fix #298 button element +// elem.wrap(''); +// elem.css("z-index", "-1000") +// elem.parent().append(fileElem); +// elem = elem.parent(); +// } +// if (elem.css("position") === '' || elem.css("position") === 'static') { +// elem.css("position", "relative"); +// } elem = fileElem; } elem.bind('change', function(evt) { diff --git a/dist/angular-file-upload.min.js b/dist/angular-file-upload.min.js index 50062f56..6805c1eb 100644 --- a/dist/angular-file-upload.min.js +++ b/dist/angular-file-upload.min.js @@ -1,2 +1,2 @@ /*! 1.6.9 */ -!function(){var a=angular.module("angularFileUpload",[]);a.service("$upload",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{},d.transformRequest=d.transformRequest||function(b,c){return window.ArrayBuffer&&b instanceof window.ArrayBuffer?b:a.defaults.transformRequest[0](b,c)};var e=b.defer();window.XMLHttpRequest.__isShim&&(d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){e.notify(a)},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&e.notify(a)},!1))}}),a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)});var f=e.promise;return f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(b){b.headers=b.headers||{},b.headers["Content-Type"]=void 0,b.transformRequest=b.transformRequest||a.defaults.transformRequest;var c=new FormData,e=b.transformRequest,f=b.data;return b.transformRequest=function(a,c){if(f)if(b.formDataAppender)for(var d in f){var g=f[d];b.formDataAppender(a,d,g)}else for(var d in f){var g=f[d];if("function"==typeof e)g=e(g,c);else for(var h=0;h'),h=0;h"),d.css("z-index","-1000"),d.parent().append(g),d=d.parent()),(""===d.css("position")||"static"===d.css("position"))&&d.css("position","relative"),d=g}d.bind("change",function(a){var d,e,g=[];if(d=a.__files_||a.target.files,null!=d)for(e=0;e0&&f[0].webkitGetAsEntry&&"file"!=c.protocol()&&f[0].webkitGetAsEntry().isDirectory)for(var h=0;h-1){var g=a(f.ngFileDragOverClass)(d,{$event:c});e[0].__drag_over_class_=g}else e[0].__drag_over_class_=f.ngFileDragOverClass||"dragover";e.addClass(e[0].__drag_over_class_)},!1),e[0].addEventListener("dragenter",function(a){a.preventDefault()},!1),e[0].addEventListener("dragleave",function(){j=b(function(){e.removeClass(e[0].__drag_over_class_),e[0].__drag_over_class_=null},f.ngFileDragOverDelay||1)},!1);var k=a(f.ngFileDrop);e[0].addEventListener("drop",function(a){a.preventDefault(),e.removeClass(e[0].__drag_over_class_),e[0].__drag_over_class_=null,h(a,function(b){k(d,{$files:b,$event:a})})},!1);var l=0}}}])}(); \ No newline at end of file +!function(){var a=angular.module("angularFileUpload",[]);a.service("$upload",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{},d.transformRequest=d.transformRequest||function(b,c){return window.ArrayBuffer&&b instanceof window.ArrayBuffer?b:a.defaults.transformRequest[0](b,c)};var e=b.defer();window.XMLHttpRequest.__isShim&&(d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){e.notify(a)},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&e.notify(a)},!1))}}),a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)});var f=e.promise;return f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(b){b.headers=b.headers||{},b.headers["Content-Type"]=void 0,b.transformRequest=b.transformRequest||a.defaults.transformRequest;var c=new FormData,e=b.transformRequest,f=b.data;return b.transformRequest=function(a,c){if(f)if(b.formDataAppender)for(var d in f){var g=f[d];b.formDataAppender(a,d,g)}else for(var d in f){var g=f[d];if("function"==typeof e)g=e(g,c);else for(var h=0;h'),h=d[0].attributes,i=0;i0&&f[0].webkitGetAsEntry&&"file"!=c.protocol()&&f[0].webkitGetAsEntry().isDirectory)for(var h=0;h-1){var g=a(f.ngFileDragOverClass)(d,{$event:c});e[0].__drag_over_class_=g}else e[0].__drag_over_class_=f.ngFileDragOverClass||"dragover";e.addClass(e[0].__drag_over_class_)},!1),e[0].addEventListener("dragenter",function(a){a.preventDefault()},!1),e[0].addEventListener("dragleave",function(){j=b(function(){e.removeClass(e[0].__drag_over_class_),e[0].__drag_over_class_=null},f.ngFileDragOverDelay||1)},!1);var k=a(f.ngFileDrop);e[0].addEventListener("drop",function(a){a.preventDefault(),e.removeClass(e[0].__drag_over_class_),e[0].__drag_over_class_=null,h(a,function(b){k(d,{$files:b,$event:a})})},!1);var l=0}}}])}(); \ No newline at end of file