I have this problem when I'm using PHP5/HTML on Apache-Tomcat6. Here's an example for one of the forms I use in my site:
<form enctype="multipart/form-data" method="post" action="hello.php" >
<label>Title* :</label>
<input type="text" name="title" />
<label>Image:</label>
<input type="file" name="image" /><br />
<input type="submit" value="Add"/>
</form>
Whenever I add the 'enctype' attribute to any form; neither the $_FILES['image'] is returned nor the $_POST variables. As long as the 'enctype' is not there, everything (except for the file input of course) works as expected. Can any one guide me please?
You won't be able to
post
data with a method ofget
on your form.In
test.html
:In
hello.php
:Depending upon your server configuration, this will combine
$_GET
,$_POST
, and$_COOKIE
, but you'll still want topost
with file inputs.