#27456 [Opn]: file upload with arrays loses $_POST vars

From: Date: Tue, 02 Mar 2004 09:14:12 +0000
Subject: #27456 [Opn]: file upload with arrays loses $_POST vars
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969359340@lists.php.net to get a copy of this message
ID: 27456 Updated by: derick@php.net Reported By: php at humbapa dot ch Status: Open -Bug Type: Unknown/Other Function +Bug Type: Documentation problem Operating System: apache 2.0.48 @ Linux 2.6.2 PHP Version: 4.3.5RC3 New Comment: You can not mix normal input fields and file upload fields in the same variable. Reclassified as documentation problem. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc (#969359340) next »