<input id="my-file-input" type="file" multiple />HTMLInputElement: multiple property / notebook
HTMLInputElement: multiple property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
let fileInput = document.getElementById("my-file-input");
if (fileInput.multiple) {
// Loop fileInput.files
for (const file of fileInput.files) {
// Perform action on one file
}
// Only one file available
} else {
let [file] = fileInput.files;
}