This is not a limit of the HTML5 File API but of the browser implementation or operating system.
Testing Firefox on Windows Vista, for example, there seemed to be effectively no limit to the number of files I could select (I tested up to 10,000). On Chrome, it appeared to return 3758 of the selected files.
The difference is that Firefox is using the new IFileOpenDialog
interface which returns the selected files as an enumeration, but Chrome seems to be using the old GetOpenFileName
API, which relies on a fixed size buffer. If the buffer isn't big enough, it's supposed to return an error, but on Vista it just returns truncated and slightly corrupted data.
Interestingly, from the number of files returned by Chrome, and the knowledge of the filenames I was testing with, I can make a fairly good guess that the buffer size being used is probably 32768.
I'm guessing you're using Windows 7 or 8 and the GetOpenFileName
API has been fixed to the extent that it now returns an error if you exceed the buffer size. So when you select too many files, the browser doesn't attempt to process the truncated data, and just returns 0.
The exact limit will be based on the length of the filenames and the path of the directory containing those files.
Other operating systems will obviously not have these same limits, but could have their own problems depending on the design of their file selection APIs.