ngx-uploader
ngx-uploader copied to clipboard
remove file issue
I select the file, and then remove it, after that select the same file again, cannot select it again. onUploadOutput() function is not triggered
Are you using drag and drop, or file select input?
i am using file select input. I solve it by adding onclick="this.value = null"
<input type="file" ngFileSelect
onclick="this.value = null"
(uploadOutput)="onUploadOutput($event)"
[uploadInput]="uploadInput"
[accept] = "accept"
multiple>
Doesn't that reset the entire upload array? I know the select same file issue was resolved with a previous commit. Did you try updating to the latest version first?
this.value = null
wont reset the upload array. The upload array is now completely separate from the html input.
Do you have any news about this problem? I've checked, the bug reproduces on the latest version (3.3.10)
no currently, ping me tomorrow please and will check on it. thanks
reproduce
@dmitrii-snytkin is there a problem with using the (click)="this.value = null"
workaround? This is not really a bug per se but a function of the browser's file input element. The browser thinks you still have the same file ready to upload, so it doesn't re-add it and emit the events.
@oleosjo I updated to latest version (4.0.0) and the problem with file select input still persist. I also tried with (click)="this.value = null" workaround but it doens't work at all.
@oleosjo Hi, I had the same problem with the last version and i resolved emitting REMOVE and CANCEL event after setting to null the input value.
Ex:
this.uploadInputEmitter.emit({ type: "remove", id: id });
this.uploadInputEmitter.emit({ type: "cancel", id: id });
or
this.uploadInputEmitter.emit({ type: "removeAll"});
this.uploadInputEmitter.emit({ type: "cancelAll" });
if you want to remove all files, and at the end set the value of the input to null
this.fileInputViewChild.nativeElement.value = null;
where id is the id of the actual file emitted on onUploadOutput method in your class.
Same problem here, with version 6.1.0. For me, the solution of @TonyLuo works
Same problem.. Solution @TonyLuo works like a charm.
Had the same problem, @TonyLuo solution worked for me