3

I have selected some files in multiple files selection (input type=file) and previewing the images with a remove button.

When clicking the remove button, I need to remove the file from multiple selection.

Is there anyway to do that?

I have tried the code below but the input file unselect all files, and I need to unselect only one

var file = document.getElementById("imgsel");
file.value = file.defaultValue;

For the following input:

<input type="file" id="imgsel" name="files[]" multiple="multiple">
Kelson Batista
  • 406
  • 4
  • 25
  • Have you tried use Var file[] =... And console.log to check the content? – pecci Feb 20 '15 at 02:24
  • Hi @pecci I have not tried yet, have no idea... can u give me a light? – Kelson Batista Feb 20 '15 at 02:26
  • Can you make a [jsFiddle demo](http://jsfiddle.net) where we can see / play with the code? – cssyphus Feb 20 '15 at 02:31
  • 1
    @KelsonBatista my answer was no good...maybe this answer helps you understand better http://stackoverflow.com/questions/7099573/is-it-possible-to-remove-individual-values-from-an-file-input-multiple-element – pecci Feb 20 '15 at 02:40
  • 1
    Other answers that may help http://stackoverflow.com/questions/19060378/how-to-remove-one-specific-selected-file-from-input-file-control http://stackoverflow.com/questions/16943605/remove-a-filelist-item-from-a-multiple-inputfile – pecci Feb 20 '15 at 02:49
  • Many thanks @pecci I will check and post answer here if I find the solution – Kelson Batista Feb 20 '15 at 03:03
  • Does this answer your question? [How to remove one specific selected file from input file control](https://stackoverflow.com/questions/19060378/how-to-remove-one-specific-selected-file-from-input-file-control) – Ajeet Shah May 14 '20 at 14:37

0 Answers0