$HTTP_RAW_POST_DATA and enctype="multipart/form-data&qu

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tomprogers
Forum Commoner
Posts: 50
Joined: Fri Mar 17, 2006 5:17 pm
Location: Minnesota
Contact:

$HTTP_RAW_POST_DATA and enctype="multipart/form-data&qu

Post by tomprogers »

Code: Select all

// php.ini
always_populate_raw_post_data = On
Given this form:

Code: Select all

<form method="post"> ... </form>
The passed data are available via $HTTP_RAW_POST_DATA. However, given this form:

Code: Select all

<form method="post" enctype="multipart/form-data"> ... </form>
$HTTP_RAW_POST_DATA is not populated. Why does this happen?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

This PHP bug from this Google. Google is your friend. ;-)
tomprogers
Forum Commoner
Posts: 50
Joined: Fri Mar 17, 2006 5:17 pm
Location: Minnesota
Contact:

Post by tomprogers »

I already read this post, and it led me to believe that the problem was fixed 3 years ago. Also, I can't tell from the thread whether it was necessary to recompile PHP without that line of code. I can't just take the server down to test a fix I'm not 100% sure how to implement.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Oh, no. The problem that was fixed was that PHP was misinterpreting files uploads from the embedded device. They didn't turn off PHP's form upload preprocessing.

I interpreted your question as "Why" it was happening, the "Why" is because PHP automatically handles form uploads for you and thus doesn't populate the raw post data, and setting enctype="multipart/form-data" makes PHP recognize it as form data. There really shouldn't be any reason why you need to access the raw post data anyway.

Of course, you might need to access it. ;-) But really can't help you until you tell us for what.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

In case someone is posting XML to your php script, there is a good reason to get access to the raw data ;) (But these days you get that from the 'php://input' 'file'.. Anyway in most cases $_FILES and $_POST are sufficient)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Ah, but XML wouldn't bother with a webform, would it?
Post Reply