php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #18881 $_FILES order is not logical
Submitted: 2002-08-13 09:33 UTC Modified: 2003-08-11 16:34 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: martijn at sheeponfire dot nl Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.2.2 OS: linux, windows
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: martijn at sheeponfire dot nl
New email:
PHP Version: OS:

 

 [2002-08-13 09:33 UTC] martijn at sheeponfire dot nl
when you submit files with a form like this:

<form method="post" enctype="multipart/form-data">
	<input type="file" name="File[one][two][]"><br>
	<input type="file" name="File[one][two][]"><br>
	<input type="submit" value="go">
</form>

the superglobal $_FILES looks like this:

Array
(
  [File] => Array
    (
      [name] => Array
        (
          [one] => Array
            (
              [two] => Array
                (
                  [0] => empty.gif
                  [1] => header.gif
                )
            )
        )
      [type] => Array
        (
          [one] => Array
            (
              [two] => Array
                (
                  [0] => image/gif
                  [1] => image/gif
                )
            )
        )
      [tmp_name] => Array
        (
          [one] => Array
            (
              [two] => Array
                (
                  [0] => /tmp/phpuploads/php2ocF9K
                  [1] => /tmp/phpuploads/phpmUbo1l
                )
            )
        )
      [error] => Array
        (
          [one] => Array
            (
              [two] => Array
                (
                  [0] => 0
                  [1] => 0
                )
            )
        )
      [size] => Array
        (
          [one] => Array
            (
              [two] => Array
                (
                  [0] => 43
                  [1] => 5128
                )
            )
        )
    )
)

Personally I think this is not very logical, I would prefer something like this:

Array
(
  [File] => Array
    (
      [one] => Array
        (
          [two] => Array
            (
              [0] => Array
                (
                  [name] => empty.gif
                  [type] => image/gif
                  [tmp_name] => /tmp/phpuploads/php2ocF9K
                  [error] => 0
                  [size] => 43
                )
              [1] => Array
                (
                  [name] => header.gif
                  [type] => image/gif
                  [tmp_name] => /tmp/phpuploads/phpmUbo1l
                  [error] => 0
                  [size] => 5128
                )                
            )            
        )        
    )
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-11 16:29 UTC] destes at ix dot netcom dot com
You are right that it's a more logical structure, but it would be a royal pain in the posterior to change it, because scripts which depend on the current structure would be invalidated.  As much as it'd be nice to change it, I don't think the return is worth the investment in hassling users when they upgrade.
 [2003-08-11 16:34 UTC] derick@php.net
Exactly, we can not change this.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 17:01:29 2024 UTC