php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32812 Post Multipart/formdata, $HTTP_POST_VARS doesn't get initialized correctly!
Submitted: 2005-04-24 21:29 UTC Modified: 2005-04-24 22:40 UTC
From: samuel at replicon dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: samuel at replicon dot com
New email:
PHP Version: OS:

 

 [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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-24 21:55 UTC] 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:58 UTC] samuel at replicon dot com
refine summary.
 [2005-04-24 22:07 UTC] tony2001@php.net
Use var_dump($HTTP_POST_VARS); to see the contents of the variable.
Also check $_POST too.
 [2005-04-24 22:13 UTC] samuel at replicon dot com
var_dump($HTTP_POST_VARS) --> NULL
  var_dump($HTTP_POST_FILES) --> NULL
 [2005-04-24 22:16 UTC] samuel at replicon dot com
var_dump($_POST) --> array(1) { ["submit"]=> string(6) "submit" }
 [2005-04-24 22:20 UTC] tony2001@php.net
Check that register_long_arrays is On.
 [2005-04-24 22:31 UTC] samuel at replicon dot com
Thanks, the Check that register_long_arrays is off. After turned it on, everything is working now.
 [2005-04-24 22:40 UTC] tony2001@php.net
.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 07:01:34 2024 UTC