|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-04-24 21:29 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 23 03:00:01 2025 UTC |
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>var_dump($_POST) --> array(1) { ["submit"]=> string(6) "submit" }