#27456 [Opn->Csd]: file upload with arrays loses $_POST vars
| From: | sean@php.net | Date: | Tue, 02 Mar 2004 17:26:05 +0000 |
| Subject: | #27456 [Opn->Csd]: file upload with arrays loses $_POST vars | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969359357@lists.php.net to get a copy of this message | ||
ID: 27456
Updated by: sean@php.net
Reported By: php at humbapa dot ch
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: apache 2.0.48 @ Linux 2.6.2
PHP Version: 4.3.5RC3
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
added the following to features.file-upload:
A developer may not mix normal input fields and file upload fields in
the same form variable (by using an input name like foo[]).
S
Previous Comments:
------------------------------------------------------------------------
[2004-03-02 04:14:11] derick@php.net
You can not mix normal input fields and file upload fields in the same
variable. Reclassified as documentation problem.
------------------------------------------------------------------------
[2004-03-02 03:39:23] php at humbapa dot ch
Description:
------------
when I use a form with all input-fields named e.g. "foo[]" the fields
after an input-file-field will be lost in the $_POST var.
Reproduce code:
---------------
<html>
<head></head>
<body>
<form method="post" enctype="multipart/form-data" action="<?=
$_SERVER['PHP_SELF'] ?>">
<input name="foo[]" type="text"><br>
<input name="foo[]" type="file"><br>
<input name="foo[]" type="file"><br>
<input name="foo[]" type="text"><br>
<input type="submit" value="go"><br>
</form>
<pre>
<?
if (count($_POST)>0) {
print_r($_POST);
print_r($_FILES);
}
?>
</pre>
</body>
</html>
Expected result:
----------------
Array
(
[foo] => Array
(
[0] => bar1
[1] => bar2
)
)
Array
(
[foo] => Array
(
[name] => Array
(
[0] => file1
[1] => file2
)
...SKIP...
Actual result:
--------------
Array
(
[foo] => Array
(
[0] => bar1
)
)
Array
(
[foo] => Array
(
[name] => Array
(
[0] => file1
[1] => file2
)
...SKIP...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27456&edit=1