ID: 32812
User updated by: samuel at replicon dot com
Reported By: samuel at replicon dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows 2000
PHP Version: 5.0.4
New Comment:
var_dump($_POST) --> array(1) { ["submit"]=> string(6) "submit" }
Previous Comments:
------------------------------------------------------------------------
[2005-04-24 22:13:47] samuel at replicon dot com
var_dump($HTTP_POST_VARS) --> NULL
var_dump($HTTP_POST_FILES) --> NULL
------------------------------------------------------------------------
[2005-04-24 22:07:44] [EMAIL PROTECTED]
Use var_dump($HTTP_POST_VARS); to see the contents of the variable.
Also check $_POST too.
------------------------------------------------------------------------
[2005-04-24 21:58:41] samuel at replicon dot com
refine summary.
------------------------------------------------------------------------
[2005-04-24 21:55:30] samuel at replicon dot com
Code to reproduce the bug
=========================
<?php
//if ($HTTP_POST_VARS['submit']) { // this statement doesn't work since
$HTTP_POST_VARS is always empty!!
if (isset($_POST['submit'])) {
// for debugging purpose
print_r($_POST);
print_r($HTTP_POST_VARS);
print_r($HTTP_POST_FILES);
if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
$error = "You did not upload a file!";
unlink($HTTP_POST_FILES['file']['tmp_name']);
} else {
copy($HTTP_POST_FILES['file']['tmp_name'],"/finallocation/".$HTTP_POST_FILES['file']['name']);
unlink($HTTP_POST_FILES['file']['tmp_name']);
print "File has been successfully uploaded!";
exit;
}
}
?>
<html>
<head></head>
<body>
<form action="<?=$PHP_SELF?>" method="post"
enctype="multipart/form-data">
<?=$error?>
<br><br>
Choose a file to upload:<br>
<input type="file" name="file"><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
------------------------------------------------------------------------
[2005-04-24 21:29:06] samuel at replicon dot com
Description:
------------
when post multipart/form-data, $HTTP_POST_VARS doesn't get initialized
correctly, actually, it's empty.
Expected result:
----------------
$HTTP_POST_VARS should contain post data
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32812&edit=1