php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45043 multi-dimensional form upload not reflected in $_POST
Submitted: 2008-05-20 01:24 UTC Modified: 2018-05-05 19:42 UTC
Votes:76
Avg. Score:4.8 ± 0.6
Reproduced:73 of 74 (98.6%)
Same Version:60 (82.2%)
Same OS:14 (19.2%)
From: ryan at groovesource dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.6 OS: Linux Debian Etch 4.0r1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ryan at groovesource dot com
New email:
PHP Version: OS:

 

 [2008-05-20 01:24 UTC] ryan at groovesource dot com
Description:
------------
To wit: a multidimensional upload will appear in $_FILES, but not in $_POST.  This seems vaguely reminiscent of #19848, but is not a dupe.

Reproduce code:
---------------
<html>
    <head>
   </head>
   <body>
        <form action="test.php" method="post" enctype="multipart/form-data">
            <input type="file" name="label[new_pics][]" /><br />
            <input type="file" name="label[new_pics][]" /><br />
            <input type="file" name="label[new_pics][]" /><br />

            <input type="submit" />
        </form>
   </body>
</html>

-------------
<?php
// test.php
print_r($_REQUEST);
print_r($_POST);
print_r($_FILES);

Expected result:
----------------
Array
(
    [label] => Array
        (
            [new_pics] => Array
                (
                    [0] => background.jpg
                    [1] => techno.png
                    [2] => picture.gif
                )
        )
)
Array

(
    [label] => Array
        (
            [new_pics] => Array
                (
                    [0] => background.jpg
                    [1] => techno.png
                    [2] => picture.gif
                )
        )
)
Array
(
    [label] => Array
        (
            [name] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => background.jpg
                            [1] => techno.png
                            [2] => picture.gif
                        )

                )

            [type] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => image/jpeg
                            [1] => image/png
                            [2] => image/gif
                        )

                )

            [tmp_name] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => /tmp/php0RVfzf
                            [1] => /tmp/phpSRTpTl
                            [2] => /tmp/phpWt2oxs
                        )

                )

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

                )

            [size] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => 131470
                            [1] => 20827
                            [2] => 59648
                        )

                )

        )

)

Actual result:
--------------
Array
(
)
Array
(
)
Array
(
    [label] => Array
        (
            [name] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => background.jpg
                            [1] => techno.png
                            [2] => picture.gif
                        )

                )

            [type] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => image/jpeg
                            [1] => image/png
                            [2] => image/gif
                        )

                )

            [tmp_name] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => /tmp/php0RVfzf
                            [1] => /tmp/phpSRTpTl
                            [2] => /tmp/phpWt2oxs
                        )

                )

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

                )

            [size] => Array
                (
                    [new_pics] => Array
                        (
                            [0] => 131470
                            [1] => 20827
                            [2] => 59648
                        )

                )

        )

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-05-05 19:42 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Type: Feature/Change Request +Type: Bug -Package: Feature/Change Request +Package: *General Issues
 [2018-05-05 19:42 UTC] requinix@php.net
Old bug report is old.

I don't remember what PHP 5.2 was doing, but currently no file upload data goes in $_POST. It's only $_FILES.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Nov 15 03:01:25 2018 UTC