3

I want to upload some large number of image files (1000+).

I want to know how many number of files the html tag can allow to select at once? If there are certain limit, please provide me with some references. When I tried uploading more than 1600 files, it does not quite accept the files.

You can quickly test here : http://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml5_input_type_file

Note: Add attribute multiple="" to the input tag to allow multiple selection.

Biswas Khayargoli
  • 976
  • 1
  • 11
  • 29
  • @YusrilMaulidanRaji It says it's fixed on chrome, but I am using chrome and it persists. :( but thanks you found the duplicate. – Biswas Khayargoli Oct 20 '16 at 11:50
  • use FTP, or some other type of transfer mechanism that is better tuned for this kind of things? My initial question would always be, why on earth would I want/need to upload 1000+ files over HTTP? – Icepickle Oct 20 '16 at 11:50
  • @BiswasKhayargoli No, it doesn't say it's fixed in Chrome. But have you tried it with Firefox? – Yusril Maulidan Raji Oct 20 '16 at 12:09

3 Answers3

2

It looks like the spec doesn't define a finite number of files you can select at once. Some implementations may have some maximum, but I wasn't able to easily find one in the source code of Chromium.

Of course, you may still be restricted by other factors, including the server's maximum payload size, and the time that it would take to upload the files on whichever network connection your users have.

Also, note that you can just use multiple as an attribute, without multiple="".

Hugh Rawlinson
  • 979
  • 9
  • 29
  • 1
    A lack of theoretical limit obviously doesn't mean there's no limit in practice - a server may refuse to accept request bodies that are too large, and instead respond with 413 Payload Too Large. – Niet the Dark Absol Oct 20 '16 at 11:41
  • Yes, you're right, I'll amend my answer to point that out. – Hugh Rawlinson Oct 20 '16 at 11:42
  • No right now, I am not uploading the files. I am just trying to select the files, when trying to select 1600+ files, the file picker does not simply respond, like it does not show how many files are selected but when picking small number of files it does. – Biswas Khayargoli Oct 20 '16 at 11:45
  • It's possible that it doesn't respond because there is some optimisation in your browser that makes the assumption that nobody would try to select 1000+ files. Which browser are you using? – Hugh Rawlinson Oct 20 '16 at 11:51
  • I am using chrome. – Biswas Khayargoli Oct 20 '16 at 11:54
0

As per the specifications and Mozilla dev docs there doesn't seem to be a limit.

This means that the limit depends on the client (browser memory, computer limits) or server that has to handle the requests.

This also means that you shouldn't just "expect" it to work, as low-end devices (or smarthphones, tablets, ...) can be a restricting factor.

Jordumus
  • 2,763
  • 2
  • 21
  • 38
  • When we select files, the file name keeps appending on the file picker dialog box. Is there a certain limit to the string appended there, like string length ? – Biswas Khayargoli Oct 20 '16 at 11:43
  • From the specs: "If the contents of a file are submitted with a form, the file input should be identified by the appropriate content type (e.g., "application/octet-stream"). If multiple files are to be returned as the result of a single form entry, they should be returned as "multipart/mixed" embedded within the "multipart/form-data"." - so one would guess not, apart from memory overflows. – Jordumus Oct 20 '16 at 11:44
0

Maybe it is better to implement a way to select 1600 files locally, then add them into one .zip file and upload that. You can then decompress (use little compression ratios if you want it to happen as fast as possible) on the server side and process the separate files.

Fréderic Cox
  • 321
  • 2
  • 7
  • 22
  • Although I agree this is a better solution (or a lib like dropzone), it doesn't answer his question to be honest. :) – Jordumus Oct 20 '16 at 11:48
  • If the answer to his question is "it can not be done" then suggesting better alternatives is information I would appreciate :-) – Fréderic Cox Oct 20 '16 at 12:09
  • thing is: the answer to this question is not "it can not be done" :D – Jordumus Oct 20 '16 at 12:33
  • There is no definite answer since it depends on client side. So it is the same as "can not be done" as in it can not be done reliably. So the developer has to find another reliable way to get the problem fixed. – Fréderic Cox Oct 20 '16 at 14:55