# max_file_uploads INI_PERDIR

- Thread: https://externals.io/message/57897
- Original archive: https://news-web.php.net/php.internals/57897
- Started by Rasmus Lerdorf on 2012-02-17T21:59:20+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #57897 — Rasmus Lerdorf — 2012-02-17T21:59:20+00:00

URL: https://externals.io/message/57897#57897

I'd like to add PHP_INI_PERDIR to max_file_uploads before 5.4.0 and also
in the next 5.3 release. This setting is very similar in scope to
max_input_vars and other POST-related limiters like upload_max_filesize,
and post_max_size all of which are PHP_INI_SYSTEM|PHP_INI_PERDIR.

The main reason is that our default for max_file_uploads is rather low
and since we count empty uploads against this limit it is easy for apps
to hit this. So if you have more than 20 type="file" fields in a form,
even if the user only actually uploads a single file, it will hit this
limit and fail.

The change it trivial and since it eases a restriction and doesn't
tighten one, it isn't going to break anything:

http://svn.php.net/viewvc/php/php-src/trunk/main/main.c?r1=323245&r2=323296

Any objections from anyone?
Stas on the 5.4.0 merge?
Johannes on the 5.3.11?

One example of pain this is currently causing:
   http://allinthehead.com/retro/349/the-curse-of-max_file_uploads

-Rasmus

---

## #57898 — Stas Malyshev — 2012-02-17T22:41:01+00:00

URL: https://externals.io/message/57897#57898 · In reply to: #57897

Hi!

> I'd like to add PHP_INI_PERDIR to max_file_uploads before 5.4.0 and also
> in the next 5.3 release. This setting is very similar in scope to

I think the change is good, I just want to understand - why before 
5.4.0? I understand the change itself - though the problem has rather 
easy workaround, as it seems: don't put that many file uploads on the 
page if you're not using them - but why the urgency?

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #57899 — Rasmus Lerdorf — 2012-02-17T23:00:45+00:00

URL: https://externals.io/message/57897#57899 · In reply to: #57898

> Hi!
> 
> > […]
> 
> I think the change is good, I just want to understand - why before
> 5.4.0? I understand the change itself - though the problem has rather
> easy workaround, as it seems: don't put that many file uploads on the
> page if you're not using them - but why the urgency?
> 

Mostly because if we put it into 5.3.11 it creates a weird gap in the
expectations. We would have to document that it is there as of 5.3.11,
but not 5.4.0, but then again in 5.4.1.

-Rasmus

---

## #57901 — Gustavo Lopes — 2012-02-18T10:33:07+00:00

URL: https://externals.io/message/57897#57901 · In reply to: #57897

On Fri, 17 Feb 2012 22:59:20 +0100, Rasmus Lerdorf <rasmus@lerdorf.com>  
wrote:


> The main reason is that our default for max_file_uploads is rather low
> and since we count empty uploads against this limit it is easy for apps
> to hit this. So if you have more than 20 type="file" fields in a form,
> even if the user only actually uploads a single file, it will hit this
> limit and fail.
>

This is not true since PHP 5.3.4. See request #50692 (don't count 0-bytes  
files towards the max_file_uploads limit).

-- 
Gustavo Lopes

---

## #57902 — Rasmus Lerdorf — 2012-02-18T18:11:39+00:00

URL: https://externals.io/message/57897#57902 · In reply to: #57901

> 
> 
> 
> > […]
> 
> This is not true since PHP 5.3.4. See request #50692 (don't count 0-bytes files towards the max_file_uploads limit).
> 

That's good, but it still doesn't make sense to me that the scope of this is different from those other related settings.

-Rasmus

---

## #57903 — Jannik Zschiesche — 2012-02-19T01:15:49+00:00

URL: https://externals.io/message/57897#57903 · In reply to: #57898

Hi Stas,

with HTML5 you can also do <input type="file" multiple="multiple" /> and 
thereby upload many files with just one file upload element.



Regards
Jannik


Am 17.02.2012 23:41, schrieb Stas Malyshev:
> Hi!
>
> > […]
>
> I think the change is good, I just want to understand - why before 
> 5.4.0? I understand the change itself - though the problem has rather 
> easy workaround, as it seems: don't put that many file uploads on the 
> page if you're not using them - but why the urgency?
