ID:               20402
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Variables related
 Operating System: Redhat 7.3
 PHP Version:      4.2.3
 New Comment:

This is not gonna change. And it's not bug.



Previous Comments:
------------------------------------------------------------------------

[2002-11-12 15:04:13] [EMAIL PROTECTED]

PHP seems to mix up array-based file uploads.  In the
simple example code I've attached, pick any two files,
and you'll get an array that looks like this:

$_FILES =

[thing]=> Array
(
  [name][test]     => ...
  [type][test]     => ...
  [tmp_name][test] => ...
  [error][test]    => ...
  [size][test]     => ...
)
[other] => Array
(
  [name]     => ...
  [type]     => ...
  [tmp_name] => ...
  [error]    => ...
  [size]     => ...
)

But you'd expect from how the last array works, that the
elements: name, type, tmp_name, error, size, are associated
with the actual uploaded file.  In that case, you'd expect:

[thing]=> Array
(
  [test] => Array
  (
    [name]     => ...
    [type]     => ...
    [tmp_name] => ...
    [error]    => ...
    [size]     => ...
  )
)
[other] => Array
(
  [name]     => ...
  [type]     => ...
  [tmp_name] => ...
  [error]    => ...
  [size]     => ...
)

This makes the $_FILES variable virtually impossible to
use in a foreach or while context, as all of the
associated elements are not associated with the array
elements, but vice versa.

This is also the crux of the problem that caused $_FILES
to be removed from $_REQUEST in CVS.  Since, if I have an
element named stuff[name] in a form upload, and a file
called stuff[thing], then the $_REQUEST variable would
contain stuff[name][thing] when it should be 
stuff[thing][name] and stuff[name] as separate elements.

------------------- Attached Code -------------------
<form method="post"
      action="<?PHP print $_SERVER['PHP_SELF']; ?>"
      enctype="MULTIPART/FORM-DATA">
  <input type="file" name="thing[test]">
  <input type="file" name="other">
  <input type="submit" value="Submit">
</form>

<pre>
<?PHP print_r($_FILES); ?>
</pre>
------------------- Attached Code -------------------


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=20402&edit=1

Reply via email to