diff --git a/src/directives/ng-file-drop.ts b/src/directives/ng-file-drop.ts index 485a34a0..a15d0156 100644 --- a/src/directives/ng-file-drop.ts +++ b/src/directives/ng-file-drop.ts @@ -68,6 +68,9 @@ export class NgFileDropDirective implements OnChanges, OnInit { return; } + if(this.options.allowedExtensions) { + this.options.allowedExtensions = this.options.allowedExtensions.map(ext => ext.toLowerCase()); + } this.options = new NgUploaderOptions(this.options); this.uploader.setOptions(this.options); } @@ -107,7 +110,7 @@ export class NgFileDropDirective implements OnChanges, OnInit { if (this.options.filterExtensions && this.options.allowedExtensions && this.files && this.files.length) { this.files = [].filter.call(this.files, (f: File) => { let allowedExtensions = this.options.allowedExtensions || []; - if (allowedExtensions.indexOf(f.type) !== -1) { + if (allowedExtensions.indexOf(f.type.toLowerCase()) !== -1) { return true; } diff --git a/src/directives/ng-file-select.ts b/src/directives/ng-file-select.ts index 67d89b05..64af1eaa 100644 --- a/src/directives/ng-file-select.ts +++ b/src/directives/ng-file-select.ts @@ -36,7 +36,9 @@ export class NgFileSelectDirective implements OnChanges { if (!this.options || !changes) { return; } - + if(this.options.allowedExtensions) { + this.options.allowedExtensions = this.options.allowedExtensions.map(ext => ext.toLowerCase()); + } this.uploader.setOptions(new NgUploaderOptions(this.options)); this.uploader._emitter.subscribe((data: any) => { @@ -76,7 +78,7 @@ export class NgFileSelectDirective implements OnChanges { if (this.options.filterExtensions && this.options.allowedExtensions && this.files && this.files.length) { this.files = [].filter.call(this.files, (f: File) => { let allowedExtensions = this.options.allowedExtensions || []; - if (allowedExtensions.toLowerCase().indexOf(f.type.toLowerCase()) !== -1) { + if (allowedExtensions.indexOf(f.type.toLowerCase()) !== -1) { return true; }