Mangler billede funktion i php mailform
Hey allesammenJeg har forsøgt at sætte en funktion ind på dette mailform hvor man kunne vedhæfte et billede.. Men kunne ikke få det til at virke...
<?php
if($submitform) {
// check required fields
$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<br>";
}
}
// check email address
if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $Email))){
$error .= "Ugyldig mail adresse<br>";}
// display errors
if($error) {
?>
<b>Fejl</b><br>
<?php echo $error; ?><br>
<a href="../kontakt.html" onClick="history.go(-1)">Prøv igen!</a>
<?php
}
else
{
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR;
// format message
$message = "Indhold af email fra $Name:
Navn: $Name
Email: $Email
Telefon: $tlf
Besked: $Comments
File: $file
-----------------------------
Browser: $browser
Bruger IP: $ip";
// send mail and print success message
$hurrah = mail($toemail,"$subject","$message","From: $Name <$Email>");
if($hurrah) {
if($autoresponse == "yes") {
$autosubject = stripslashes($autosubject);
$automessage = stripslashes($automessage);
mail($Email,"$autosubject","$automessage","From: $recipientname <$recipientemail>");
}
echo "$thanks";
}
}
}
else {
?>
<form action="<?php echo $PHP_SELF; ?>" method="post" enctype="multipart/form-data" name="contactform">
<input type="hidden" name="toemail" value="<?php echo $recipientemail; ?>">
<input type="hidden" name="toname" value="<?php echo $recipientname; ?>">
<input type="hidden" name="require" value="Name,Email,tlf,Comments,file">
<table>
<!--DWLayoutTable-->
<tr>
<td width="128" height="24" align="right" valign="top"> <div align="left">
<font color="white">Navn:</font><font size="2" face="Verdana,Arial,Helvetica"> </font></div></td>
<td width="224" valign="top"><input name="Name" size="25"></td>
</tr>
<tr>
<td height="24" align="right" valign="top"> <div align="left"> <font color="white">E-mail:</font></div></td>
<td valign="top"><input name="Email" size="25"></td>
</tr>
<tr>
<td height="24" align="right" valign="top"> <div align="left"> <font color="white">Telefon:</font></div></td>
<td valign="top"><input name="tlf" size="25"></td>
</tr>
<tr>
<td height="24" align="right" valign="top"> <div align="left"> <font color="white">Vedhæft fil</font></td>
<td><input type="file" size="50" name="file"></td>
</tr>
<tr>
<td height="85" align="right" valign="top"> <div align="left"> <font color="white">Besked:</font></div></td>
<td valign="top"><textarea name="Comments" rows="5" cols="35"></textarea></td>
</tr>
<tr>
<td height="54" colspan="2" align="center" valign="top"><input type="submit" value="Send" name="submitform">
<input type="reset" value="Fortryd" name="reset"></td>
</tr>
</table>
<br>
</form>
<?php } ?>
Nogle som kan hjælpe...?