HTMLInputElement: multiple property - Web APIs | MDN

Value

A boolean value.

Examples

html

<input id="my-file-input" type="file" multiple />

js

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;
}

Specifications

Specification
HTML
# dom-input-multiple

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.