From: [EMAIL PROTECTED]
Operating system: Suse (2.2.16 kernel)
PHP version: 4.0.4pl1
PHP Bug Type: HTTP related
Bug description: File upload problem when the form control name is an array element
Precis:
I was trying to submit a form divided into sections, each
section having a two text fields and a file upload. The
form was structured as an array called $section, each
element an array containing firstname, surname and image.
The image details I expected to turn up in $HTTP_POST_FILES as
$HTTP_POST_FILES[section][0][name] etc. That behaved as
expected.
The other form elements I expected to turn up as
$HTTP_POST_VARS[section][0][firstname] etc. However
what I ended up with was $HTTP_POST_VARS[section][0]
being set to the filesize of the uploaded file, overwriting
all other elements in that section.
// ---------------start upload.php--------------------------
<?php
print "<pre>\nVars:\n";
print_r($HTTP_POST_VARS);
print "\nFiles:\n";
print_r($HTTP_POST_FILES);
print "</pre>\n";
?>
<form method='post' enctype='multipart/form-data'>
<input type='text' name='section[0][firstname]'> <br>
<input type='text' name='section[0][surname]'> <br>
<input type='file' name='section[0][image]'> <br>
<input type='submit'>
</form>
// ---------------end upload.php----------------------------
// ---------------start input ------------------------------
section[0][firstname] = foo
section[0][surname] = bar
section[0][image] = ~/feathers.gif
// ---------------end input --------------------------------
// ---------------start output -----------------------------
Vars:
Array
(
[section] => Array
(
[0] => 12409
)
)
Files:
Array
(
[section] => Array
(
[0] => Array
(
[name] => Array
(
[image] => feathers.gif
)
[type] => Array
(
[image] => image/gif
)
[tmp_name] => Array
(
[image] => /tmp/phpwwJSPf
)
[size] => Array
(
[image] => 12409
)
)
)
)
// ---------------end output -------------------------------
--
Edit Bug report at: http://bugs.php.net/?id=9460&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]