#17958 [Com]: <input type=file> loses $_POST vars

From: Date: Thu, 19 Sep 2002 05:54:26 +0000
Subject: #17958 [Com]: <input type=file> loses $_POST vars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19702@lists.php.net to get a copy of this message
 ID:               17958
 Comment by:       nando@aboutown.ca
 Reported By:      ddp@deakin.edu.au
 Status:           Critical
 Bug Type:         Apache2 related
 Operating System: Linux 2.4.18
 PHP Version:      4.2.3
 New Comment:

I am experiencing the same POST problem.
I thought it might have been an HTMLENTITIES problem
(which I posted an error) but after reading these 
bug reports, I get the same thing.
I spent 3+ days programming around this.
Very frustrating.


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

[2002-09-18 20:10:54] adeshner@pisem.net

Mozilla 1.1a is OK either; it seems to be an IE6.0 bug (maybe, a
specially coded feature?)

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

[2002-09-18 13:53:45] jmax01@hotmail.com

Retraction:
I had two errors in my header after fixing these errors I can access
$_POST varibles in both 4.0.6 and 4.2.3.
It appears that some multipart/form-data parsers are more forgiving
than others :) 

POST /cgi-bin/XXXXXXX HTTP/1.1
Authorization: Basic XXXXXXXX
Content-Type: multipart/form-data;
boundary=XXXssxvnjhpdqdxvcrastvybcwvmgnykrXXX
User-Agent: Java1.4.0
Host: XXX.XXX.XXX.X:XXX
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-length: 142
--XXXssxvnjhpdqdxvcrastvybcwvmgnykrXXX
Content-Disposition: form-data; name="fieldName"

fieldValue
--XXXssxvnjhpdqdxvcrastvybcwvmgnykrXXX--

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

[2002-09-18 04:26:10] adeshner@pisem.net

I am using PHP 4.2.3 with Apache/1.3.20, RedHat 7.2.

When uploading files with enctype="multipart/form-data" I experienced
the next problem: all files of types other then text/plain or text/html
had been corrupted, e.g., the first 4 lines of a gif picture were:

GIF89a% wered.gif"
Content-Type: image/gif

GIF89a%
, that is, the file name was "ra-powered.gif", a part of this,
content-type and an empty line from the posted data had been added to
the beginning of the file. The following image data remained intact.
The preceding post variable (as phpinfo() listed:

_POST["submit-type"] updat  - must be "update"
_FILES["picture"]    Array
(
    [name] => ra-powered.gif
    [type] => image/gif
    [tmp_name] => /tmp/phpjsjZRj
    [error] => 0
    [size] => 3810
)
_SERVER["CONTENT_TYPE"] multipart/form-data;
boundary=---------------------------7d213414b022e  

) had been corrupt (1-4 last characters cut off, depends on the
content-type). All other variables were ok.
The problem is only with IE 6.0, Opera, Netscape6 and Konqueror are ok.
Tests with PHP 4.2.0 and 4.2.2 show the same results.

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

[2002-09-17 09:41:13] jmax01@hotmail.com

Hi,

I have tested using the following platforms:

Platform 1:
OS: Windows XP Professional
Webserver: Apache/2.0.40
PHP: 4.2.3 

Platform 2:
OS: Windows 2000 Professional
Webserver: Apache 2.0.40
PHP: 4.2.3 

Platform 3:
OS: Windows 2000 Professional
Webserver: Apache 1.3.26
PHP: 4.2.3

I use a custom http client to connect to the http server.
The http requests are multipart/form-data.

A sample request:
POST /cgi-bin/XXXXXXX HTTP/1.1
Authorization: Basic XXXXXXXX
Content-Type: multipart/form-data;
boundary=XXXssxvnjhpdqdxvcrastvybcwvmgnykrXXX
User-Agent: Java1.4.0
Host: XXX.XXX.XXX.X:XXX
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-length: 142

XXXssxvnjhpdqdxvcrastvybcwvmgnykrXXX
Content-Disposition: form-data; name="fieldName"

fieldValue
XXXssxvnjhpdqdxvcrastvybcwvmgnykrXXX-- 

The $_POST array is empty.
I have tested against IBM HTTP Server/V5R2M0 and have not had a probelm
retrieving multipart/form-data POST variables using IBM REXX CGI
Parse.

I am pretty sure my header is valid.

Thanks,
Jeff

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

[2002-09-16 09:19:23] marc@twisted-pair.de

I currently have got the problem of lost _POST-Vars even without the
enctype=... stuff.

All post vars are lost.

Browsers: Mozilla/1.0, lynx
OS: Debian Linux/PPC
Server: Apache 2.0.40
PHP: 4.2.3/4.3.0(cvs)

Is there any "workaround"? (e.g. downgrading Apache or PHP)

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17958

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



Thread (39 messages)

« previous php.bugs (#19702) next »