valor-software / ng2-file-upload

Easy to use Angular components for files upload
http://valor-software.github.io/ng2-file-upload/
MIT License
1.91k stars 662 forks source link

Impossible to select file with the same name twice in select single mode #1273

Open vsc-cnst opened 4 months ago

vsc-cnst commented 4 months ago

In single file mode, after deleting the selected file, it is not possible to select a file with the same name.

Reprosteps

As provided in the example at https://valor-software.com/ng2-file-upload/

  1. On the 'Single' section cick on 'Chose File' button
  2. Chose a file
  3. Remove the inserte file from the 'Upload queue'
  4. Again On the 'Single' section cick on 'Chose File' button
  5. Chose the same file
  6. NOT OK - the file is not loaded
Gillardo commented 3 months ago

I am also experiencing this issue

lhargil commented 1 week ago

To fix this, the input[type=file] element's value needs to be cleared after every upload.

One way to do this is to handle the onAfterAddingFile event of the FileUploader and set the input[type=file] element's value to '' using the Renderer2.setProperty on the input[type=file] ElementRef.