nicematt nicematt - 10 months ago 44
HTML Question

Update the status of a input[type=file] when change files

I've this file input:

<input type="file" id="fileSelector" multiple="true">

If I add or remove files inside this input, it doesn't update its text.

fileSelector.files = [];

E.g, if its text is "2 files selected" and I change the
array, it doesn't update this text.

How to update this text?


It is not possible to set the value of FileList of <input type="file"> element .files programmatically; FileList is read-only