php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52446 only 20 upload fields supportted under windows
Submitted: 2010-07-26 19:06 UTC Modified: 2010-07-29 10:42 UTC
From: djwang at manze dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.2.14 OS: Windows 2003
Private report: No CVE-ID: None
 [2010-07-26 19:06 UTC] djwang at manze dot com
Description:
------------
when I run the test script under windows (win2003+iis+php or win2003+apache+php), the $_FILES array will not return more than 20 elements, but it return 30 elements under FreeBSD.



Test script:
---------------
<? print_r($_FILES);?>
<form action="t.php" method="post" enctype="multipart/form-data">
1<input type="file" name="abc[]">2<input type="file" name="abc[]">
3<input type="file" name="abc[]">4<input type="file" name="abc[]">
5<input type="file" name="abc[]">6<input type="file" name="abc[]">
7<input type="file" name="abc[]">8<input type="file" name="abc[]">
9<input type="file" name="abc[]">10<input type="file" name="abc[]">
11<input type="file" name="abc[]">12<input type="file" name="abc[]">
13<input type="file" name="abc[]">14<input type="file" name="abc[]">
15<input type="file" name="abc[]">16<input type="file" name="abc[]">
17<input type="file" name="abc[]">18<input type="file" name="abc[]">
19<input type="file" name="abc[]">20<input type="file" name="abc[]">
21<input type="file" name="abc[]">22<input type="file" name="abc[]">
23<input type="file" name="abc[]">24<input type="file" name="abc[]">
25<input type="file" name="abc[]">26<input type="file" name="abc[]">
27<input type="file" name="abc[]">28<input type="file" name="abc[]">
29<input type="file" name="abc[]">30<input type="file" name="abc[]">
<input type="submit">
</form>

Expected result:
----------------
under FreeBSD+apache+php the test code will return $_FILES array with 30 elements like this:

Array
(
    [abc] => Array
        (
            [name] => Array
                (
                    [0] => 
                    [1] => 
                    [2] => 
                    [3] => 
                    [4] => 
                    [5] => 
                    [6] => 
                    [7] => 
                    [8] => 
                    [9] => 
                    [10] => 
                    [11] => 
                    [12] => 
                    [13] => 
                    [14] => 
                    [15] => 
                    [16] => 
                    [17] => 
                    [18] => 
                    [19] => 
                    [20] => 
                    [21] => 
                    [22] => 
                    [23] => 
                    [24] => 
                    [25] => 
                    [26] => 
                    [27] => 
                    [28] => 
                    [29] => 
                )
 
            [type] => Array
                (
                    [0] => 
                    [1] => 
                    [2] => 
                    [3] => 
                    [4] => 
                    [5] => 
                    [6] => 
                    [7] => 
                    [8] => 
                    [9] => 
                    [10] => 
                    [11] => 
                    [12] => 
                    [13] => 
                    [14] => 
                    [15] => 
                    [16] => 
                    [17] => 
                    [18] => 
                    [19] => 
                    [20] => 
                    [21] => 
                    [22] => 
                    [23] => 
                    [24] => 
                    [25] => 
                    [26] => 
                    [27] => 
                    [28] => 
                    [29] => 
                )
 
            [tmp_name] => Array
                (
                    [0] => 
                    [1] => 
                    [2] => 
                    [3] => 
                    [4] => 
                    [5] => 
                    [6] => 
                    [7] => 
                    [8] => 
                    [9] => 
                    [10] => 
                    [11] => 
                    [12] => 
                    [13] => 
                    [14] => 
                    [15] => 
                    [16] => 
                    [17] => 
                    [18] => 
                    [19] => 
                    [20] => 
                    [21] => 
                    [22] => 
                    [23] => 
                    [24] => 
                    [25] => 
                    [26] => 
                    [27] => 
                    [28] => 
                    [29] => 
                )
 
            [error] => Array
                (
                    [0] => 4
                    [1] => 4
                    [2] => 4
                    [3] => 4
                    [4] => 4
                    [5] => 4
                    [6] => 4
                    [7] => 4
                    [8] => 4
                    [9] => 4
                    [10] => 4
                    [11] => 4
                    [12] => 4
                    [13] => 4
                    [14] => 4
                    [15] => 4
                    [16] => 4
                    [17] => 4
                    [18] => 4
                    [19] => 4
                    [20] => 4
                    [21] => 4
                    [22] => 4
                    [23] => 4
                    [24] => 4
                    [25] => 4
                    [26] => 4
                    [27] => 4
                    [28] => 4
                    [29] => 4
                )
 
            [size] => Array
                (
                    [0] => 0
                    [1] => 0
                    [2] => 0
                    [3] => 0
                    [4] => 0
                    [5] => 0
                    [6] => 0
                    [7] => 0
                    [8] => 0
                    [9] => 0
                    [10] => 0
                    [11] => 0
                    [12] => 0
                    [13] => 0
                    [14] => 0
                    [15] => 0
                    [16] => 0
                    [17] => 0
                    [18] => 0
                    [19] => 0
                    [20] => 0
                    [21] => 0
                    [22] => 0
                    [23] => 0
                    [24] => 0
                    [25] => 0
                    [26] => 0
                    [27] => 0
                    [28] => 0
                    [29] => 0
                )
 
        )
 
)


Actual result:
--------------
but under windows 2003, I can't upload more than 20 files. the $_FILES array will only have 20 elements like:

Array
(
    [abc] => Array
        (
            [name] => Array
                (
                    [0] => 
                    [1] => 
                    [2] => 
                    [3] => 
                    [4] => 
                    [5] => 
                    [6] => 
                    [7] => 
                    [8] => 
                    [9] => 
                    [10] => 
                    [11] => 
                    [12] => 
                    [13] => 
                    [14] => 
                    [15] => 
                    [16] => 
                    [17] => 
                    [18] => 
                    [19] => 
                )
 
            [type] => Array
                (
                    [0] => 
                    [1] => 
                    [2] => 
                    [3] => 
                    [4] => 
                    [5] => 
                    [6] => 
                    [7] => 
                    [8] => 
                    [9] => 
                    [10] => 
                    [11] => 
                    [12] => 
                    [13] => 
                    [14] => 
                    [15] => 
                    [16] => 
                    [17] => 
                    [18] => 
                    [19] => 
                )
 
            [tmp_name] => Array
                (
                    [0] => 
                    [1] => 
                    [2] => 
                    [3] => 
                    [4] => 
                    [5] => 
                    [6] => 
                    [7] => 
                    [8] => 
                    [9] => 
                    [10] => 
                    [11] => 
                    [12] => 
                    [13] => 
                    [14] => 
                    [15] => 
                    [16] => 
                    [17] => 
                    [18] => 
                    [19] => 
                )
 
            [error] => Array
                (
                    [0] => 4
                    [1] => 4
                    [2] => 4
                    [3] => 4
                    [4] => 4
                    [5] => 4
                    [6] => 4
                    [7] => 4
                    [8] => 4
                    [9] => 4
                    [10] => 4
                    [11] => 4
                    [12] => 4
                    [13] => 4
                    [14] => 4
                    [15] => 4
                    [16] => 4
                    [17] => 4
                    [18] => 4
                    [19] => 4
                )
 
            [size] => Array
                (
                    [0] => 0
                    [1] => 0
                    [2] => 0
                    [3] => 0
                    [4] => 0
                    [5] => 0
                    [6] => 0
                    [7] => 0
                    [8] => 0
                    [9] => 0
                    [10] => 0
                    [11] => 0
                    [12] => 0
                    [13] => 0
                    [14] => 0
                    [15] => 0
                    [16] => 0
                    [17] => 0
                    [18] => 0
                    [19] => 0
                )
 
        )
 
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-26 20:07 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-07-26 20:07 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2010-07-27 03:53 UTC] djwang at manze dot com
-Status: Feedback +Status: Open
 [2010-07-27 03:53 UTC] djwang at manze dot com
I have updated the test script as follow:
------------------------------
<?php
echo sizeof($_FILES[abc][name]);  //echo how many file elements in $_FILE array.
?>
<form action="<?=$_SERVER[PHP_SELF]?>" method="post" enctype="multipart/form-data">
<?php
for($i=1;$i<=30;$i++){ //create a form contain 30 file upload fields.
    echo $i."-<input type=\"file\" name=\"abc[]\"><br />";
}
?>
<input type="submit">
</form>
Expected result:
----------------
If I put the test script under Freebsd or Linux(Apache+PHP) and submit the form, it will return: 

30

Actual result:
--------------
When I put this test script under windows system(win2003+iis+php or win2003+apache+php) and submit the form, it will return:

20

So when I upload more than 20 files in same time , my script which run on Windows will only get 20 files and lost others.
 [2010-07-28 16:01 UTC] txyoji at yahoo dot com
http://php.net/manual/en/ini.core.php

The max_file_uploads directive has been available since PHP 5.2.12.
Its default value is 20.
 [2010-07-29 10:42 UTC] djwang at manze dot com
-Status: Open +Status: Closed
 [2010-07-29 10:42 UTC] djwang at manze dot com
Thanks. 
It's really difficult to find this change.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 14:01:29 2024 UTC