Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngFileSelect: re-selecting same file #235

Closed
natwallbank opened this issue Jun 3, 2014 · 4 comments
Closed

ngFileSelect: re-selecting same file #235

natwallbank opened this issue Jun 3, 2014 · 4 comments

Comments

@natwallbank
Copy link

Hi,

I've just migrated some custom in-house code to use angular-file-upload (good job, btw!) and am just hitting one problem.

We use ngFileSelect to add files to a queue, so users can either select or drag files into a queue and they can remove items from that queue before hitting an 'Upload' button.

If a user removes a file from the queue (just an array on my directive scope) but then decides they made a mistake and re-adds the file, it doesn't work, presumably because the file input is holding some state.

I remember we encountered this problem with our own custom directive that did a similar job, and the way we resolved it was by doing the following at the end of the 'change' event handler:

elem.replaceWith(elem.clone(true));

I'm just wondering whether this is a known issue and if you have any kind of workaround for it?

Thanks in advance.

Nat

@danialfarid
Copy link
Owner

Prior to version 1.4 it would set the value of the input to null upon click so you could upload one file twice, but since it wasn't working in IE10 and this behaviour was not intuitive or expected for some cases (for example if you click on the select and then cancel the popup it would clear the previous file) it's been removed from the code.

So the workaround is to just set the value of the input to null onclick="this.value=null". Follow this issue for workarounds for IE10-11:
#141 (comment)

@akshay-bbytes
Copy link

onclick="this.value=null" worked fine for me, thanks :)

@rajguru827
Copy link

it's not working in windows safari.

@JDVS20
Copy link

JDVS20 commented Oct 17, 2017

I resolved this issue using this,

onChange(event:any):void{
event.srcElement.value = "";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants