From: php at humbapa dot ch
Operating system: apache 2.0.48 @ Linux 2.6.2
PHP version: 4.3.5RC3
PHP Bug Type: Unknown/Other Function
Bug description: file upload with arrays loses $_POST vars
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 bug report at http://bugs.php.net/?id=27456&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27456&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27456&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27456&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27456&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27456&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27456&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27456&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27456&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27456&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27456&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27456&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27456&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27456&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27456&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27456&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27456&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27456&r=float