Re: retrieve POST body?
| From: | Gregory Beaver | Date: | Fri, 20 Apr 2007 03:01:54 +0000 |
| Subject: | Re: retrieve POST body? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253311@lists.php.net to get a copy of this message | ||
Justin Frim wrote:
> Sorry burst your bubble, but your solution isn't a viable one in my case.
> php://input only works if the form is submitted using
> application/x-www-form-urlencoded.
>
> Take your sample HTML code there and add enctype="multipart/form-data"
> to the <form> tag, and I'm pretty sure you'll find that php://input
> contains no data. (Both PHP 5.2.1 running as a CGI on Windows and PHP
> 5.2.0 running as an Apache module on FreeBSD exhibit this behaviour.)
>
> And before anyone asks, it *is* a requirement to accept
> multipart/form-data submissions because that's the only way you can
> properly implement a file upload on a web form.
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