What is the max number of files to select in an HTML5 [multiple] file input?

why this many files?

The number of files depends on the number of characters all file names are combined.

Why this max?

In the Windows API, the maximum path length limitation is 256 chars, the Unicode version API is 32,767 chars.

Chrome simply sets the max path length of the Unicode version API, so it’s about 32k chars as you observed.
Check this fix: https://code.google.com/p/chromium/issues/detail?id=44068

Firefox dynamically allocates a buffer big enough to hold the size of multiple selected files, which could handle much larger path length.
Check this fix: https://bugzilla.mozilla.org/show_bug.cgi?id=660833

Is it OS dependent or browser dependent?

Both.

Where do I find the specs for that?

For Windows API usage and reference:
http://msdn.microsoft.com/en-us/library/aa365247.aspx (Maximum Path Length Limitation)
http://msdn.microsoft.com/en-us/library/ms646839(VS.85).aspx

Is it JS’ fault?

No.

Leave a Comment