There is a lot to mess up with uploading, so you are going to have to tell us what went wrong exactly.
Also, it might help if you distill your problem down to the simplest use-case possible, create a new form handler that does not delve into emails etc.
The key events to snag are:
Did your file upload at all?
What error messages are being spewed out?
Did you move your file from the temp directory to somewhere useful?
This is one area where you really go through the manual pages with a fine tooth comb, it tells you how to do all of this stuff because it can be time consuming to understand, and do securely.
```php
$flag=0;
$imgflag=0;//for image format verification flag
if(isset($imgfile[0])&&($imgfile[0]!="")&&(($HTTP_POST_FILES['imgfile[0]']['type']!="image/gif")&& ($HTTP_POST_FILES['imgfile[0]']['type']!="image/jpeg")))
$imgflag=1;
//if the format of image is not matched
if($imgflag==1)
{
print<<<END
<script language="Javascript">
alert("Image files should be of gif/jpeg format");
history.go(-1);
</script>
END;
}
//if u want to insert into database:)
if(isset($imgfile[0])&&($imgfile[0]!=""))
{
$flag=1;
$img0 = $HTTP_POST_FILES['imgfile[0]']['name'];
$query1 = "update table_name set image='$img0' where condition";
$result1=mysql_query($query1);
if(!$result1) die('Invalid Query: '. mysql_error());
}
//if it shows some syntax errors but it is working
END
echo "Your details have been successfully submitted - Click the 'back button' to return to the previous page";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
Thanks in advance[/QUOTE]