Our image upload form always returns the error message, "Invalid file. Please click the 'Back' button on your browser and try again." Here are the basics.
==HTML FORM==
<form enctype=="multipart/form-data" action="phpscript.php" method="post">
<input type="file" name="uploadedfile[]">
<input type="file" name="uploadedfile[]">
<input type="file" name="uploadedfile[]">
<input type="submit" value="Submit" />
</form>
==PHP SCRIPT==
<?php
if ((($_FILES["uploadedfile"]["type"] == "image/gif")
|| ($_FILES["uploadedfile"]["type"] == "image/jpeg")
|| ($_FILES["uploadedfile"]["type"] == "image/jpg")
|| ($_FILES["uploadedfile"]["type"] == "image/png")
|| ($_FILES["uploadedfile"]["type"] == "image/bmp")
|| ($_FILES["uploadedfile"]["type"] == "image/pjpeg"))
&& ($_FILES["uploadedfile"]["size"] < 20000))
{
move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],
"http://mydomain.com/uploads/" . $_FILES["uploadedfile"]["name"]);
$send = mail($to, $subject, $body, $headers);
header( "Location: http://www.mydomain.com/" );
}
else {echo "Invalid file. Please click the 'Back' button on your browser and try again.";}
?>
I've tried rearranging the upload form PHP, but if the form works at all it just sends us the rest of the form information in an email (which we want it to do) but the images never upload to the "uploads" folder. What's wrong?