Can't upload same file twice #220
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?
Seems like after uploading a file, it doesn't trigger the upload next time. I have to change the filename to make it work. However, I set the removeAfterUpload property to true but not seems to be work either. Is there anything else I need to configure?
+1
I am facing the similar kind of issue in IE.
If I upload a file and than cancel than cancel the File and delete the file from its actual location.
Firstly I am not able to remove the file untill and Close the brower.
Somehow. IE if refering the file path. tried many options, but no one help.
A work around would be to put
ngIfdirective on your file input elementEg:
<input type="file" ng2FileSelect [uploader]="uploader" *ngIf="uploader.queue.length==0" />Or creating custom button like in demo.ts and set the
<input>value to ''.See http://stackoverflow.com/questions/3144419/how-do-i-remove-a-file-from-the-filelist#3162319
I don't know if it works on old IE, but looks OK for IE11.
You don't need to create custom button. Suppose your target from which you want to delete filename is single
<input>, add change event to it:then set
onAfterAddingFilefunction that are called after added to queue:Little cleaner:
Thank @Namek !!! It worked.
@t246246 your solution also worked. Thank you.
My Contructor:
Method
HTML
<input type="file" ng2FileSelect [uploader]="uploader" (change)="onChange($event);"/>Does anyone knows why this happen and if a fix in the project is possible?
@valorkin, this was fixed in 1.2.0 and can be closed.
awesome
thanks
Great, thank you!
guys FileUploader not exists in angular 4. Any workaround ?
Same problem in version 1.2.1 so I would say not fixed....
I resolved this issue using this,
onChange(event:any):void{
event.srcElement.value = "";
}
@JDVS20 i test your code this worked for me, but in the input file i can't see the name of file
@JDVS20 if in IE11, the 'event.srcElement.value = ""' sentence will trigger the onChange event again
Why is this issue closed if its not solved ?
Bruno
thank you so much.
you need to empty the input file value after upload(here !'m clearing input value after onSuccessItem you may go with on onErrorItem also
here the code worked for me
HTML:
<input type="file" name="myfile"#activeFrameinputFileng2FileSelect [uploader]="frameUploader" (change)="frameUploader.uploadAll()" />component
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';@ViewChild('activeFrameinputFile')InputFrameVariable: ElementRef;this.frameUploader.onSuccessItem = (item, response, status, headers) => {this.InputFrameVariable.nativeElement.value = '';};set value = '' worked here. Thank you!
Working fine when the method is called after file upload method