#23765 [Ana]: No raw post data from multipart forms

From: Date: Fri, 23 May 2003 15:10:40 +0000
Subject: #23765 [Ana]: No raw post data from multipart forms
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40288@lists.php.net to get a copy of this message
 ID:               23765
 User updated by:  bugs dot php dot com at brome dot com
 Reported By:      bugs dot php dot com at brome dot com
 Status:           Analyzed
-Bug Type:         Documentation problem
+Bug Type:         Variables related
 Operating System: Slackware Linux
 PHP Version:      4.3.1
 New Comment:

Okay, then how can I handle this upload situation? A 50K file is being
uploaded, and appearing only as a four-byte string in the $_POST array.
PHP is mangling and/or throwing away the file data, and there's no way
at all to get at the raw data?? I can't change anything on the client
side, because it's hard-coded into a Nokia mobile phone.

Perhaps the bug is in PHP's handling of multipart form data. It would
be ideal if this files data appeared in the $_FILES array like it's
supposed to. Unfortunately, since you're saying there's no way get at
the raw data, I can't show you what it's NOT parsing correctly...

Any thoughts?


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

[2003-05-22 20:06:17] sniper@php.net

This is not a bug, neither $HTTP_RAW_POST_DATA or php://input 
contain the POST uploads as those are handled internally
by PHP itself before your script is run.

Some note would be nice somewhere in the manual about this..



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

[2003-05-22 18:42:30] bugs dot php dot com at brome dot com

I'm trying to receive HTTP POST file uploads from an embedded device.
For some reason, PHP isn't recognizing the file data correctly, and the
file data is showing up in $_POST instead of $_FILES. Unlike a bug
reported by someone else, the POST vars are coming through just fine.

So I'd like to use $HTTP_RAW_POST_DATA or php://input to parse it
manually, but both are empty whenever receiving multipart form-data,
which of course is necessary, and is hard-coded into the device.

Trying to make a similar request using a test form and a regular
browser, again both $HTTP_RAW_POST_DATA and php://input are empty, but
if I simply remove enctype="multipart/form-data" from the form, I can
then see the full raw input using both methods.

Here's the test form:

<form enctype="multipart/form-data" action="upload_photo_action.php"
method="post">
<p>DirId: <input type=text name="DirId" value="1"></p>
<p>Filename: <input type=text name="Filename"></p>
<p>Send this file: <input type=file name="ImageData"></p>
<input type=submit value="Send File">
</form>

...and here's my config line:

'./configure' '--prefix=/usr/local/apache/php' '--with-jpeg-dir'
'--with-mysql=/usr/local/mysql' '--enable-trans-sid'
'--enable-track-vars' '--enable-bcmath' '--enable-ftp'
'--with-gd'
'--with-png-dir' '--with-zlib-dir' '--with-openssl=/usr/local/ssl'
'--with-apxs=/usr/local/apache/bin/apxs'

Thanks!

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


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



Thread (9 messages)

« previous php.bugs (#40288) next »