Unable to select the file again , after remove #906
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
In your demo, if I select a single file, add it and then remove it, I cannot select it again.
In demo code, you use
item.remove()but does it remove from the queue as well?Thanks
Same problem. Seems it happens because old file still selected in input[type=file] element, and when you select same file, the onchange event doesn't fire.
@NomiJ you cant try this :
add change event in your html
<input type="file" ng2FileSelect [uploader]="uploader" (change)="onChange($event);"/>and in your component add this:
onChange(event:any):void{ event.srcElement.value = ''; }To avoid errors in Firefox, you should use this method:
public onChange(event: any): void { event.target.value = ''; }I linked my HTML input to my TS by using a ViewChild.
@ViewChild('selectFileField') private selectFileField: ElementRef;I then did as told above but on "remove" event instead (on any item).
onRemoveItem(): void { this.selectFileField.nativeElement.value = ''; }So I can still have the input field showing the file name instead of 'No file selected' or so.