php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17958 <input type=file> loses $_POST vars
Submitted: 2002-06-25 00:28 UTC Modified: 2002-12-29 05:03 UTC
Votes:54
Avg. Score:4.8 ± 0.4
Reproduced:53 of 54 (98.1%)
Same Version:28 (52.8%)
Same OS:27 (50.9%)
From: ddp at deakin dot edu dot au Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4.2.3 OS: Linux 2.4.18
Private report: No CVE-ID: None
 [2002-06-25 00:28 UTC] ddp at deakin dot edu dot au
When I include an <input type=file> in a form and post it (whether or not I actually upload a file) the $_POST vars are cut short.  This is with Apache-2.0.39 and both php-4.2.1 and with a CVS version (from 25 June 2002).

See the script (tst.php) below:

<html>
<head>
<title>File Upload Test</title>
<meta http-equiv="Content-Type" content="text/html;">
</head>

<body bgcolor="#FFFFFF">
<pre>
<?php
print "print_r( $_POST ) :";
if (isset($_POST)) { print_r($_POST); }

?>
</pre>
<form enctype="multipart/form-data" action="tst.php" method="post">
<input type="hidden" name="VAR1" value="1">
Send this file: <input type="file" name="userfile[]">
<!-- comment out the line above for VAR2 to be successfully
posted
-->
<input type="hidden" name="VAR2" value="2">
<input type="submit" value="Test">
</form>
</body>
</html>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-25 11:08 UTC] sniper@php.net
Just to clarify this: That last hidden field is not in $_POST ?

 [2002-06-25 21:51 UTC] ddp at deakin dot edu dot au
Sorry, yes the output with the <input type="file"> line in the html is:

print_r( Array ) :Array
(
    [VAR1] => 1
)

Without the above line, VAR1 and VAR2 are displayed.
 [2002-09-23 15:12 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

When trying to replicate this bug please make sure your file_uploads php.ini value is set to On. In some versions of PHP, POST vars would get lost on multipart forms when this option has a blank or Off value.
 [2002-10-10 03:34 UTC] ichwilleineemailadresse at gmx dot net
Reproduced with snapshot of 2002-09-28.
Didn't see any changes.
 [2002-12-29 05:03 UTC] derick@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC