php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48077 Multi-dimensional $_FILES are not consistent.
Submitted: 2009-04-25 16:32 UTC Modified: 2009-04-25 17:46 UTC
From: jose dot nobile at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2.9 OS: Win XP+Apache 2.2.11+PHP 5.2.9-2
Private report: No CVE-ID: None
 [2009-04-25 16:32 UTC] jose dot nobile at gmail dot com
Description:
------------
At POST request with multidimensional form vars, $_FILES are not "correctly" assign, the $_FILES is not "easy" to handle with actual multidimensional assign, it is not consistent.

Reproduce code:
---------------
<?PHP
if($_SERVER['REQUEST_METHOD'] == 'POST'){
print_r($_FILES);
}
?>


<form name="form" action="" enctype="multipart/form-data" method="POST">
<input type="file" name="file[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="submit" value="Submit" />

</form>

Expected result:
----------------
Array
(
[file] => Array
 (
    [0] => Array
        (
            [name] => foto internet workstation.JPG
            [type] => image/jpeg
            [tmp_name] => C:\wamp\tmp\php171.tmp
            [error] => 0
            [size] => 99115
        )

    [1] => Array
        (
            [name] => gfs 0.JPG
            [type] => image/jpeg
            [tmp_name] => C:\wamp\tmp\php172.tmp
            [error] => 0
            [size] => 26263
        )

    [2] => Array
        (
            [name] => hoja membretiada.jpg
            [type] => image/jpeg
            [tmp_name] => C:\wamp\tmp\php173.tmp
            [error] => 0
            [size] => 245987
        )

    [3] => Array
        (
            [name] => img005CEDULA ADMINISTRATIVA.jpg
            [type] => image/jpeg
            [tmp_name] => C:\wamp\tmp\php174.tmp
            [error] => 0
            [size] => 283589
        )

    [4] => Array
        (
            [name] => kathe 3 copy.jpg
            [type] => image/jpeg
            [tmp_name] => C:\wamp\tmp\php175.tmp
            [error] => 0
            [size] => 122558
        )
  )
)



Actual result:
--------------
Array
(
    [file] => Array
        (
            [name] => Array
                (
                    [0] => foto internet workstation.JPG
                )

            [type] => Array
                (
                    [0] => image/jpeg
                )

            [tmp_name] => Array
                (
                    [0] => C:\wamp\tmp\php15C.tmp
                )

            [error] => Array
                (
                    [0] => 0
                )

            [size] => Array
                (
                    [0] => 99115
                )

        )

    [foto] => Array
        (
            [name] => Array
                (
                    [0] => gfs 0.JPG
                    [1] => hoja membretiada.jpg
                    [2] => img005CEDULA ADMINISTRATIVA.jpg
                    [3] => kathe 3 copy.jpg
                )

            [type] => Array
                (
                    [0] => image/jpeg
                    [1] => image/jpeg
                    [2] => image/jpeg
                    [3] => image/jpeg
                )

            [tmp_name] => Array
                (
                    [0] => C:\wamp\tmp\php15D.tmp
                    [1] => C:\wamp\tmp\php15E.tmp
                    [2] => C:\wamp\tmp\php15F.tmp
                    [3] => C:\wamp\tmp\php160.tmp
                )

            [error] => Array
                (
                    [0] => 0
                    [1] => 0
                    [2] => 0
                    [3] => 0
                )

            [size] => Array
                (
                    [0] => 26263
                    [1] => 245987
                    [2] => 283589
                    [3] => 122558
                )

        )

)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-25 17:20 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 05:01:32 2024 UTC