To clear an HTML file input with JavaScript, we set its value
property to an empty string.
For instance, we write
document.querySelector("#input-field").value = "";
to select the file input with querySelector
.
Then we set its value
property to an empty string to clear the file input.