# On native, single-input, multiple file uploads

DevFeed: [On native, single-input, multiple file uploads](<https://devfeed.tech/articles/on-native-single-input-multiple-file-uploads-51948.md>)

Original publisher: [Read original article](<https://lea.verou.me/2009/03/regarding-native-single-input-multiple-file-uploads/>)

Author: Lea Verou

Published: 2009-03-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [Lea Verou's blog](<https://devfeed.tech/sources/lea-verou-s-blog.md>)

Topics: [Web Development](<https://devfeed.tech/topics/web-development.md>), [browser](<https://devfeed.tech/topics/browser.md>), [WebKit](<https://devfeed.tech/topics/webkit.md>), [if statement](<https://devfeed.tech/topics/if-statement.md>), [Internet Explorer](<https://devfeed.tech/topics/internet-explorer.md>)

Tags: [articles](<https://devfeed.tech/tags/articles.md>), [blog](<https://devfeed.tech/tags/blog.md>), [browser](<https://devfeed.tech/tags/browser.md>), [browsers](<https://devfeed.tech/tags/browsers.md>), [bug](<https://devfeed.tech/tags/bug.md>), [development](<https://devfeed.tech/tags/development.md>), [feature](<https://devfeed.tech/tags/feature.md>), [feature-detection](<https://devfeed.tech/tags/feature-detection.md>), [features](<https://devfeed.tech/tags/features.md>), [file](<https://devfeed.tech/tags/file.md>), [files](<https://devfeed.tech/tags/files.md>), [flexible](<https://devfeed.tech/tags/flexible.md>), [forms](<https://devfeed.tech/tags/forms.md>), [html](<https://devfeed.tech/tags/html.md>), [input](<https://devfeed.tech/tags/input.md>), [js](<https://devfeed.tech/tags/js.md>), [min](<https://devfeed.tech/tags/min.md>), [multiple](<https://devfeed.tech/tags/multiple.md>), [native](<https://devfeed.tech/tags/native.md>), [news](<https://devfeed.tech/tags/news.md>), [opera](<https://devfeed.tech/tags/opera.md>), [properties](<https://devfeed.tech/tags/properties.md>), [safari](<https://devfeed.tech/tags/safari.md>), [select](<https://devfeed.tech/tags/select.md>), [standard](<https://devfeed.tech/tags/standard.md>), [uploads](<https://devfeed.tech/tags/uploads.md>), [webkit](<https://devfeed.tech/tags/webkit.md>), [webkit-bugs](<https://devfeed.tech/tags/webkit-bugs.md>)

## AI overview

The excerpt describes two native ways to allow multiple file selection in one file input: Safari 4's `multiple` attribute and Opera's Web Forms 2.0 `min`/`max` attributes. It gives feature checks for each and combines them by enabling whichever supported mechanism is detected, with a preferred workaround left for other browsers. The author recommends fallbacks where neither is supported. Safari 4's `multiple` property was not then exposed for detection; the excerpt says the WebKit team had fixed a reported bug and that support was expected in a later nightly build. Mozilla implementation is presented as pending a Bugzilla request.

## Source excerpt

If you are following the current news on web development, you probably heard that the new Safari 4 has a great feature: It natively allows the user to select multiple files via a single input control, if you specify a value for the attribute multiple: <input type="file" multiple> or, in XHTML: <input type="file" multiple="multiple" /> You might not know that Opera supported multiple file uploads for a while now, based on the earlier Web Forms 2.0 standard in a slightly different (and more flexible) format: <input type="file" min="1" max="9999″ /> Can we use those currently? Sure we can, but we should provide fallbacks for the other browsers. Using these features will put pressure on the other browser vendors to implement them as well and generally, native is always better. How can we find out whether the browser supports them? Opera Opera supports accessing those min and max properties as properties of the element. So, it's quite trivial to check whether Opera-style multiple inputs are supported: var supportsMin = (function(){ var fi = document.createElement('input'); fi.type = 'file'; return fi.min === '' && fi.max === ''; })(); Safari 4 In Safari 4 the check would be equally simple, if it supported accessing the multiple attribute as a property. Then we could easily check whether it's boolean and conclude that Safari-style multiple inputs are supported: var supportsMultiple = (function(){ var fi = document.createElement('input'); fi.type = 'file'; // The second check is probably redundant but what if in the future an implementor // decides to make the file inputs to handle multiple selections by default? // Yeah, it's not likely, but it's not entirely impossible. return fi.multiple === false || fi.multiple === true; })(); However, that's currently not the case. The good news are that I reported this as a bug today, and the Webkit team fixed it, so it will be possible in the next Webkit nightly! Combining the two You can easily combine these two together with the w