0

I have a multiple file upload. I want to remove the selected index from the file list using jquery.

var x = document.getElementById("thumb");
$('body').on('click', 'a.cvf_delete_image', function (e) {
    e.preventDefault();
    $(this).parent().remove('');
    var y =x.files;
    var file = $(this).parent().attr('file');
    for (var i = 0; i < storedFiles.length; i++) {
        if (storedFiles[i].name == file) {
            storedFiles.splice(i, 1);
            y.splice(i, 1);
            break;
        }
    }

   // var actual_file = $("#thumb").files(storedFiles);

});

this is what I tried but y.splice(i, 1); is not working

Neha
  • 2,136
  • 5
  • 21
  • 50
Nighina t t
  • 140
  • 1
  • 4
  • 15
  • 2
    [How do I remove a file from the FileList](https://stackoverflow.com/questions/3144419/how-do-i-remove-a-file-from-the-filelist) – Sudhir Ojha Jun 19 '19 at 06:30
  • 2
    Possible duplicate of [How do I remove a file from the FileList](https://stackoverflow.com/questions/3144419/how-do-i-remove-a-file-from-the-filelist) – Alive to die - Anant Jun 19 '19 at 06:36

0 Answers0