The HTMLInputElement.multiple property indicates if an input can have more than one value. Firefox currently only supports multiple for <input type="file">.


// fileInput is a <input type=file multiple>
let fileInput = document.getElementById('myfileinput');

if (fileInput.multiple == true) {

  for (let i = 0; i < fileInput.files.length; i++) {
    // Loop fileInput.files

// Only one file available
} else {
  let file = fileInput.files.item(0);

See also


Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support 3.6IE ? Opera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?


Full support  
Full support
Compatibility unknown  
Compatibility unknown

Document Tags and Contributors

Last updated by: mdnwebdocs-bot,