No raw post data from multipart forms
| Bug #23765 | No raw post data from multipart forms | ||||
|---|---|---|---|---|---|
| Submitted: | 2003-05-22 18:42 UTC | Modified: | 2003-05-23 18:12 UTC | ||
| From: | bugs dot php dot com at brome dot com | Assigned: | pollita (profile) | ||
| Status: | Closed | Package: | *General Issues | ||
| PHP Version: | 4.3.1 | OS: | Slackware Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2003-05-22 18:42 UTC] 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!
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2003-05-22 20:06 UTC] sniper@php.net
[2003-05-23 10:10 UTC] bugs dot php dot com at brome dot com
[2003-05-23 10:19 UTC] sniper@php.net
[2003-05-23 11:31 UTC] bugs dot php dot com at brome dot com
[2003-05-23 12:47 UTC] sniper@php.net
[2003-05-23 12:48 UTC] sniper@php.net
[2003-05-23 13:06 UTC] pollita@php.net
I'd like you to try recompiling PHP with upload support completely disabled. Look for the following line in main/php_content_types.c (it'll be near the top) and simply comment it out or delete it entirely. { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler }, Recompile like that and rerun a test using: <?php $fp = fopen('serverdata.txt', 'w'); fwrite($fp, serialize($_SERVER)); fclose($fp); copy('php://input', 'logfile.txt'); ?> And show us what you get. (Though since you're uploading a picture feel free to snip the binary data in logfile.txt down to a representative sample)[2003-05-23 13:25 UTC] bugs dot php dot com at brome dot com
[2003-05-23 14:07 UTC] pollita@php.net
[2003-05-23 16:18 UTC] pollita@php.net
[2003-05-23 16:31 UTC] bugs dot php dot com at brome dot com
[2003-05-23 16:39 UTC] pollita@php.net
[2003-05-23 18:12 UTC] bugs dot php dot com at brome dot com
[2003-11-29 14:07 UTC] sangapum at hotmail dot com