Remove a FileList item from a multiple “input:file” in HTML5


When there is a situation where we need to remove items from DOM’s through JavaScript, we cannot do so directly from FileList object. We need to assign the following to an array:

$('input:file#upload')[1].files

After that remove items from this array using splice or method of our choice and use that array.

Another way is to upload files with the help of HTML file uploader and then delete corresponding objects by using JavaScript.

Updated on: 30-Jan-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements