Odd behavior in form enctype="multipart/form-data"

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
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Odd behavior in form enctype="multipart/form-data"

Post by qartis »

I've been editing phpBB2 (2.0.4), specifically profile.php, to include one of those "type the string you see in the image into a textbox" human-verification thingies into phpbb's registration script. Now, they've obfuscated the code quite a bit, created 3 files instead of 1, and also they've gotten the registration and profile viewing/editing all done with the same function set. So, I managed to craftily incorporate my little functions into the form, but all of a sudden, the profile.php?mode=register form, which starts with

Code: Select all

<form action="profile.php" enctype="multipart/form-data" method="post">
Refuses to pass GET or POST variables. Completely. I tried everything I could think of, and I finally found out that the enctype="multipart/form-data" is the culprit. Thing is, that line is necessary to allow avatar uploads, et cetera. Server is Apache 1.3.27, PHP 4.1.2, RedHat 7.3, no unusual extensions loaded. Am I doing something really dumb here, or what?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

not really answering your question (I really don't know by now ):
what did you do to profile.php? ;)
why not in includes/usercp_register.php?
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

Oh, I didn't put the bulk of the new stuff into profile.php, but all registrations won't work now, and I found out it's because the action of the main registration form is to profile.php, with the post variable "mode" set to "register", but if I change profile.php to

Code: Select all

<?
print_r($_POST);
exit
?>
It doesn't receive any of them, but if I take out the form's enctype, it works beautifully.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

without your changes does it work with enctype="multipart/form-data" ?
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

No, which is puzzling. Even on a brand spanking new phpbb, it won't pass any more data via multipart forms. Meh, I disabled avatar uploads to the board, removed the enctype of the form, and the new code works beautifully.

But, granted "good enough" isn't good enough, why do POST (and GET, now) variables get mangled in a multipart form? They shouldn't, so what portion of the server would malfunction and be *able* to do that? Apache, or PHP; it's not the browser.

Maybe it's time for a recompile.
Post Reply