diff --git a/demo/war/index.html b/demo/war/index.html index 951e6f02..c0d78e35 100644 --- a/demo/war/index.html +++ b/demo/war/index.html @@ -78,6 +78,6 @@

-
Last update: 2014-03-24
+
Last update: 2014-03-27
diff --git a/demo/war/js/angular-file-upload.js b/demo/war/js/angular-file-upload.js index 360241f2..b35edb96 100644 --- a/demo/war/js/angular-file-upload.js +++ b/demo/war/js/angular-file-upload.js @@ -208,11 +208,16 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', function($pars evt.preventDefault(); elem.removeClass(attr['ngFileDragOverClass'] || "dragover"); var files = [], items = evt.dataTransfer.items; - for (var i = 0; i < items.length; i++) { - if (items[i].webkitGetAsEntry) { + if (items && items.length > 0 && items[0].webkitGetAsEntry) { + for (var i = 0; i < items.length; i++) { traverseFileTree(files, items[i].webkitGetAsEntry()); - } else { - files.push(items[i]); + } + } else { + var fileList = evt.dataTransfer.files; + if (fileList != null) { + for (var i = 0; i < fileList.length; i++) { + files.push(fileList.item(i)); + } } } (function callback(delay) { diff --git a/dist/angular-file-upload-html5-shim.js b/dist/angular-file-upload-html5-shim.js index a05dbc94..82df3caf 100644 --- a/dist/angular-file-upload-html5-shim.js +++ b/dist/angular-file-upload-html5-shim.js @@ -1,7 +1,7 @@ /**! * AngularJS file upload shim for angular XHR HTML5 browsers * @author Danial - * @version 1.3.0 + * @version 1.3.1 */ if (window.XMLHttpRequest) { if (window.FormData) { diff --git a/dist/angular-file-upload-html5-shim.min.js b/dist/angular-file-upload-html5-shim.min.js index 2f3b7736..5ddd60a4 100644 --- a/dist/angular-file-upload-html5-shim.min.js +++ b/dist/angular-file-upload-html5-shim.min.js @@ -1,2 +1,2 @@ -/*! 1.3.0 */ +/*! 1.3.1 */ window.XMLHttpRequest&&window.FormData&&(XMLHttpRequest=function(a){return function(){var b=new a;return b.setRequestHeader=function(a){return function(c,d){if("__setXHR_"===c){var e=d(b);e instanceof Function&&e(b)}else a.apply(b,arguments)}}(b.setRequestHeader),b}}(XMLHttpRequest),window.XMLHttpRequest.__isShim=!0); \ No newline at end of file diff --git a/dist/angular-file-upload-shim.js b/dist/angular-file-upload-shim.js index eccb2aec..9bcfdf9a 100644 --- a/dist/angular-file-upload-shim.js +++ b/dist/angular-file-upload-shim.js @@ -1,7 +1,7 @@ /**! * AngularJS file upload shim for HTML5 FormData * @author Danial - * @version 1.3.0 + * @version 1.3.1 */ (function() { diff --git a/dist/angular-file-upload-shim.min.js b/dist/angular-file-upload-shim.min.js index 7a14ae19..1a4e941b 100644 --- a/dist/angular-file-upload-shim.min.js +++ b/dist/angular-file-upload-shim.min.js @@ -1,2 +1,2 @@ -/*! 1.3.0 */ +/*! 1.3.1 */ !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};if(window.XMLHttpRequest&&(window.FormData?window.XMLHttpRequest=function(a){return function(){var b=new a;return b.setRequestHeader=function(a){return function(c,d){if("__setXHR_"===c){var e=d(b);e instanceof Function&&e(b)}else a.apply(b,arguments)}}(b.setRequestHeader),b}}(window.XMLHttpRequest):(window.XMLHttpRequest=function(b){return function(){var c=new b,d=c.send;return c.__requestHeaders=[],c.open=function(a){return c.upload||(c.upload={}),c.__listeners=[],c.upload.addEventListener=function(a,b){c.__listeners[a]=b},function(b,d,e){a.apply(c,[b,d,e]),c.__url=d}}(c.open),c.getResponseHeader=function(a){return function(b){return c.__fileApiXHR?c.__fileApiXHR.getResponseHeader(b):a.apply(c,[b])}}(c.getResponseHeader),c.getAllResponseHeaders=function(a){return function(){return c.__fileApiXHR?c.__fileApiXHR.getAllResponseHeaders():a.apply(c)}}(c.getAllResponseHeaders),c.abort=function(a){return function(){return c.__fileApiXHR?c.__fileApiXHR.abort():null==a?null:a.apply(c)}}(c.abort),c.setRequestHeader=function(a){return function(b,d){if("__setXHR_"===b){var e=d(c);e instanceof Function&&e(c)}else a.apply(c,arguments)}}(c.setRequestHeader),c.send=function(){if(arguments[0]&&arguments[0].__isShim){var b=arguments[0],e={url:c.__url,complete:function(a,b){!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 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}}),Object.defineProperty(c,"responseText",{get:function(){return b.responseText}}),c.__fileApiXHR=b,c.onreadystatechange()},progress:function(a){a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f',c=c.firstChild;var d=b.parentNode;d.insertBefore(c,b),d.removeChild(b),c.appendChild(b),b.__isWrapped=!0}},c=function(a){return function(b){var c=FileAPI.getFiles(b);b.target||(b.target={}),b.target.files=c,b.target.files.item=function(a){return b.target.files[a]||null},a(b)}},d=function(a,b){return("change"===b.toLowerCase()||"onchange"===b.toLowerCase())&&"file"==a.getAttribute("type")};HTMLInputElement.prototype.addEventListener&&(HTMLInputElement.prototype.addEventListener=function(a){return function(e,f,g,h){d(this,e)?(b(this),a.apply(this,[e,c(f),g,h])):a.apply(this,[e,f,g,h])}}(HTMLInputElement.prototype.addEventListener)),HTMLInputElement.prototype.attachEvent&&(HTMLInputElement.prototype.attachEvent=function(a){return function(e,f){d(this,e)?(b(this),a.apply(this,[e,c(f)])):a.apply(this,[e,f])}}(HTMLInputElement.prototype.attachEvent)),window.FormData=FormData=function(){return{append:function(a,b,c){this.data.push({key:a,val:b,name:c})},data:[],__isShim:!0}},function(){if(window.FileAPI||(window.FileAPI={}),!FileAPI.upload){var b,c,d,e,f,g=document.createElement("script"),h=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)b=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)c=window.FileAPI.jsPath;else for(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()}}()}window.FileReader||(window.FileReader=function(){function a(a,c){var d={type:a,target:b,loaded:c.loaded,total:c.total,error:c.error};return null!=c.result&&(d.target.result=c.result),d}var b=this,c=!1;this.listeners={},this.addEventListener=function(a,c){b.listeners[a]=b.listeners[a]||[],b.listeners[a].push(c)},this.removeEventListener=function(a,c){b.listeners[a]&&b.listeners[a].splice(b.listeners[a].indexOf(c),1)},this.dispatchEvent=function(a){var c=b.listeners[a.type];if(c)for(var d=0;d - * @version 1.3.0 + * @version 1.3.1 */ (function() { @@ -208,11 +208,16 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', function($pars evt.preventDefault(); elem.removeClass(attr['ngFileDragOverClass'] || "dragover"); var files = [], items = evt.dataTransfer.items; - for (var i = 0; i < items.length; i++) { - if (items[i].webkitGetAsEntry) { + if (items && items.length > 0 && items[0].webkitGetAsEntry) { + for (var i = 0; i < items.length; i++) { traverseFileTree(files, items[i].webkitGetAsEntry()); - } else { - files.push(items[i]); + } + } else { + var fileList = evt.dataTransfer.files; + if (fileList != null) { + for (var i = 0; i < fileList.length; i++) { + files.push(fileList.item(i)); + } } } (function callback(delay) { diff --git a/dist/angular-file-upload.min.js b/dist/angular-file-upload.min.js index eba2ba60..6ecaab5c 100644 --- a/dist/angular-file-upload.min.js +++ b/dist/angular-file-upload.min.js @@ -1,2 +1,2 @@ -/*! 1.3.0 */ -!function(){var a=angular.module("angularFileUpload",[]);a.service("$upload",["$http","$timeout",function(a,b){function c(c){c.method=c.method||"POST",c.headers=c.headers||{},c.transformRequest=c.transformRequest||function(b,c){return window.ArrayBuffer&&b instanceof window.ArrayBuffer?b:a.defaults.transformRequest[0](b,c)},window.XMLHttpRequest.__isShim&&(c.headers.__setXHR_=function(){return function(a){c.__XHR=a,c.xhrFn&&c.xhrFn(a),a.upload.addEventListener("progress",function(a){c.progress&&b(function(){c.progress&&c.progress(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&b(function(){c.progress&&c.progress(a)})},!1)}});var d=a(c);return d.progress=function(a){return c.progress=a,d},d.abort=function(){return c.__XHR&&b(function(){c.__XHR.abort()}),d},d.xhr=function(a){return c.xhrFn=a,d},d.then=function(a,b){return function(d,e,f){c.progress=f||c.progress;var g=b.apply(a,[d,e,f]);return g.abort=a.abort,g.progress=a.progress,g.xhr=a.xhr,g}}(d,d.then),d}this.upload=function(b){b.headers=b.headers||{},b.headers["Content-Type"]=void 0,b.transformRequest=b.transformRequest||a.defaults.transformRequest;var d=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;h0&&j[0].webkitGetAsEntry)for(var k=0;k angular-file-upload Angular file upload - 1.3.0 + 1.3.1 Danial Farid, Georgios Diamantopoulos (nuget package) Danial Farid https://github.com/danialfarid/angular-file-upload/blob/master/LICENSE diff --git a/package.json b/package.json index 902acb45..cf7a6395 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-file-upload", - "version": "1.3.0", + "version": "1.3.1", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-uglify": "~0.2.7",