diff --git a/src/ngx-uploader/directives/ng-file-select.directive.ts b/src/ngx-uploader/directives/ng-file-select.directive.ts index 33b08965..a7c28fdc 100644 --- a/src/ngx-uploader/directives/ng-file-select.directive.ts +++ b/src/ngx-uploader/directives/ng-file-select.directive.ts @@ -26,6 +26,8 @@ export class NgFileSelectDirective implements OnInit, OnDestroy { this.upload = new NgUploaderService(concurrency, allowedContentTypes); this.el = this.elementRef.nativeElement; + + this.el.addEventListener('click', this.clickListener, false); this.el.addEventListener('change', this.fileListener, false); this._sub.push( @@ -46,6 +48,12 @@ export class NgFileSelectDirective implements OnInit, OnDestroy { } } + clickListener = () => { + if(this.el.value) { + this.el.value = ''; + } + } + fileListener = () => { if (this.el.files) { this.upload.handleFiles(this.el.files);