Re: retrieve POST body?

From: Date: Fri, 20 Apr 2007 04:21:18 +0000
Subject: Re: retrieve POST body?
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-253318@lists.php.net to get a copy of this message
Interesting... But how will the user-agent know how to pack the data? AFAIK, if you don't specify enctype in the <form> tag, the user-agent will assume application/x-www-form-urlencoded. I'm assuming that if you put in something that's not recognized (like multipart/x-non-parsed-form-data), the user-agent won't know what it is and will again default to application/x-www-form-urlencoded. So to use the dirty hack suggested by Rasmus in that IRC log, I'd need some way of instructing the user-agent to use multipart/form-data, but then destroy the Content-Type header in the request *before* PHP sees it and snags the body. Gregory Beaver wrote:
Good news and bad news. Rasmus reports on IRC: [21:57] <Rasmus_> We never buffer the data in file upload mode [21:57] <Rasmus_> it is streamed to disk, so no, you can't get it all in a variable like that [21:57] <Rasmus_> set a different content-type if you want to do that [21:57] <Rasmus_> assuming you have control over the client [21:58] <CelloG> can you do a file upload without multipart? [21:59] <Rasmus_> Well, if you want to pick a POST apart yourself, sure [21:59] <Rasmus_> set a mime type PHP doesn't understand and it will be in http_raw_post_data and then you can do whatever you want with it So the answer is "sort of." You would have to parse the POST data yourself, but it is technically a possibility. Regards, Greg -- Experience the revolution, buy the PEAR Installer Manifesto http://www.packtpub.com/book/PEAR-installer


« previous php.general (#253318) next »