Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML input type="file" too many files in Chrome? [duplicate]

Given this minimal, complete, and verifiable example:

<html>
  <head>
    <script>
      var handleFiles = function(event) {
        console.log('# of files: ' + event.target.files.length);
      };
    </script>
  </head>
  <body>
    <input type="file" onchange="handleFiles(event)" multiple/>
  </body>
</html>

I am not able to select my test case of 1682 files in Chrome (though it works in Firefox). My test case is 316 megabytes, so I slimmed it down to a folder with a similar number of files, but simple text files containing one character. The problem persisted. Is there a problem with Chrome's implementation of handling this control? If so is there a polyfill? How can I select 1682 files in Chrome?

like image 405
Scotty H Avatar asked Oct 30 '22 01:10

Scotty H


1 Answers

It looks like it's not working because the upload is limited by the total number of characters in all of the file names combined. The limit seems to be about 32K characters.

See these:

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

https://bugs.chromium.org/p/chromium/issues/detail?id=44068

like image 191
Nathan Bierema Avatar answered Nov 14 '22 18:11

Nathan Bierema