php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36907 $_FILES Array broken with Array like input names
Submitted: 2006-03-29 09:29 UTC Modified: 2006-03-29 15:48 UTC
From: olaf at 7val dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.1.2 OS: Linux
Private report: No CVE-ID: None
 [2006-03-29 09:29 UTC] olaf at 7val dot com
Description:
------------
When using input elements with names like  "file[a][b][c]" the $_FILES Array is broken.

With more than one input element it get even worse!

Reproduce code:
---------------
<html><head>
<title>Test</title>
</head>
<body>
<pre>
<?PHP 
print_r($_FILES);
?>
</pre>
<form name="form1" enctype="multipart/form-data" method="post" ><input name="file[a][b][c]" size="25" accept="*/*" type="file">
<input type="submit" value="OK" name="submit">
</form>
</body>
</html>

Expected result:
----------------
Array
(
    [file] => Array
	   (
          [a] => Array
		        (
				  [b] => Array 
				     (
					   [c] => Array 
					     (
						  [name] => dsc00051.jpg
						  [type] => image/jpeg
						  [tmp_name] => /tmp/phpL3mhkD
						  [error] => 0
						  [size] => 56484
						 )
					 )
				)
        )
)


Actual result:
--------------
Array
(
    [file] => Array
        (
            [name] => Array
                (
                    [a] => Array
                        (
                            [b] => Array
                                (
                                    [c] => dsc00051.jpg
                                )

                        )

                )

            [type] => Array
                (
                    [a] => Array
                        (
                            [b] => Array
                                (
                                    [c] => image/jpeg
                                )

                        )

                )

            [tmp_name] => Array
                (
                    [a] => Array
                        (
                            [b] => Array
                                (
                                    [c] => /tmp/php2W1O7R
                                )

                        )

                )

            [error] => Array
                (
                    [a] => Array
                        (
                            [b] => Array
                                (
                                    [c] => 0
                                )

                        )

                )

            [size] => Array
                (
                    [a] => Array
                        (
                            [b] => Array
                                (
                                    [c] => 56484
                                )

                        )

                )

        )

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-29 13:58 UTC] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2006-03-29 15:30 UTC] olaf at 7val dot com
I checked the documentation an I am sure this actually _is_ a bug!

According to documentation:

<input name="file[a][b][c]" size="25" accept="*/*" type="file">

should give
$_FILES[a][b][c]['name'] = [uploaded_file_name]
 [2006-03-29 15:48 UTC] mgf@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.

No, the manual describes exactly what you are getting.  Go read it again.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC