diff --git a/package.json b/package.json index 2ff5bff2..14a121bd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ng2-uploader", "description": "Angular2 File Uploader", - "version": "1.5.1", + "version": "1.5.2", "license": "MIT", "main": "ng2-uploader.js", "typings": "ng2-uploader.d.ts", diff --git a/src/directives/ng-file-drop.ts b/src/directives/ng-file-drop.ts index 9ce5f988..3f66e14a 100644 --- a/src/directives/ng-file-drop.ts +++ b/src/directives/ng-file-drop.ts @@ -108,6 +108,10 @@ export class NgFileDropDirective { } @HostListener('change') onChange(): void { + if (!this.el.nativeElement.files || !this.el.nativeElement.files.length) { + return; + } + this.files = Array.from(this.el.nativeElement.files); if (this.options.filterExtensions && this.options.allowedExtensions) {