ENCTYPE="multipart/form-data" problem

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
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

ENCTYPE="multipart/form-data" problem

Post by djot »

when i send a form with

<form method="post" action="" ENCTYPE="multipart/form-data">

php 4.2.0 returns exactly nothing (no entered data). The same form without ENCTYPE="multipart/form-data" is send successfully with all data included. For sure, uploads that are inside my form also don't work anymore :(

any suggestions?
User avatar
Pointybeard
Forum Commoner
Posts: 71
Joined: Wed Sep 03, 2003 7:23 pm
Location: Brisbane, AUS
Contact:

Post by Pointybeard »

I take it your trying to send file information? Just remember that $_POST has your textboxes, options, select etc. $_FILES has your file information of the files you would have specified in file fields. Just try print_r($_POST) and print_r($_FILES) and see what your getting. Hope that helps.
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

no, nothing is sent

Post by djot »

The problem is that nothing is sent. All like $_GET, $_POST, $_SERVER, $_REQUEST even $QUERY_STRING, $HTTP_POST_VARS and all others I found are empty, when enctype is inside the opening form-tag.

If i remove the enctype only, the form works normally, sends all data (except the uploads for sure).

My main problem is that it doesn't even sent the normal input data with enctype in form tag.

Seems like the form is closed for some reason before the first data could be entered. As I said, I don't get anything, no GET and no POST data only due to that enctype statement. I have the same running fine local on one and online on two servers not running that old php 4.2.0. But that server with 4.2.0 can't handle the enctype it seems. Even a form with just one <input type=text> stays emtpy when enctpye is inserted.

djot
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

is "action" optional? You may want to put something there, even if you want the page to go to itself. For example:

Code: Select all

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

the action statement is not the problem. If you leave action emtpy like action="" the form returns to where i is called from (same for not even inluding action="")
And for sure I did test that with action="" and action"form.php" and action="form.php?parameters" already.
The problem still is that i get no returns from the form with enctype inside. without enctype insdie everything is fine.
Post Reply