ngx-uploader icon indicating copy to clipboard operation
ngx-uploader copied to clipboard

remove file issue

Open TonyLuo opened this issue 6 years ago • 13 comments

I select the file, and then remove it, after that select the same file again, cannot select it again. onUploadOutput() function is not triggered

TonyLuo avatar Aug 14 '17 04:08 TonyLuo

Are you using drag and drop, or file select input?

oleosjo avatar Aug 17 '17 13:08 oleosjo

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>

TonyLuo avatar Aug 18 '17 15:08 TonyLuo

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?

tsmith-sdm avatar Aug 22 '17 21:08 tsmith-sdm

this.value = null wont reset the upload array. The upload array is now completely separate from the html input.

oleosjo avatar Aug 23 '17 13:08 oleosjo

Do you have any news about this problem? I've checked, the bug reproduces on the latest version (3.3.10)

dmitrii-snytkin avatar Aug 29 '17 10:08 dmitrii-snytkin

no currently, ping me tomorrow please and will check on it. thanks

jkuri avatar Aug 29 '17 10:08 jkuri

reproduce

dmitrii-snytkin avatar Sep 01 '17 09:09 dmitrii-snytkin

@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 avatar Sep 01 '17 13:09 oleosjo

@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.

flacohenao avatar Oct 04 '17 05:10 flacohenao

@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.

arismamo avatar Oct 20 '17 11:10 arismamo

Same problem here, with version 6.1.0. For me, the solution of @TonyLuo works

ilteoood avatar Sep 30 '18 20:09 ilteoood

Same problem.. Solution @TonyLuo works like a charm.

matheusz2 avatar Oct 10 '18 18:10 matheusz2

Had the same problem, @TonyLuo solution worked for me

hamayun-cpu avatar Aug 09 '22 22:08 hamayun-cpu