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> var fileInput = document.getElementById("myfileinput"); if (fileInput.multiple == true) { for (var i = 0, len = fileInput.files.length; i < len; i++) { // loop fileInput.files } // only one file available } else { var file = fileInput.files.item(0); }
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | Yes | 3.6 | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | ? | ? | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/multiple