Hej denne side virke ikke helt. Mine filer der bliver sendt kan ikke åbnes hvad gør jeg forkert??
if(isset($_POST) && !empty($_POST)) {
$emne = $_POST['emne'];
$besked = $_POST['tekst'];
$fra = "ungdomsudvalg@roklubbenfureso.dk";
//hvis der er en fil
if(!empty($_FILES['vedhaeft_fil']['name'])) {
$file_name = $_FILES['vedhaeft_fil']['name'];
$temp_name = $_FILES['vedhaeft_fil']['tmp_name'];
$file_type = $_FILES['vedhaeft_fil']['type'];
$file = $temp_name;
$content = chunk_split(base64_encode(file_get_contents($file)));
$uid = md5(uniqid(time()));
$header ="From: ".$fra."\r\n";
$header .= "Reply-To: ".$fra."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: Multipart/mixed; Boundary =\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message im MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$header .= $besked."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: ".$file_type."; name=\"".$file_name."\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$file_name."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
} else {
$header ="From: ".$fra."\r\n";
$header .= "Reply-To: ".$fra."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$header .= $besked."\r\n\r\n";
}
//send mail til webmaster
if (mail('webmaster@roklubbenfureso.dk', $emne, "", $header)) {
echo "webmaster@roklubbenfureso.dk OK";
} else {
echo "webmaster@roklubbenfureso.dk FEJL";
}
echo"<br>";
} else {
echo"
<form action=index.php?indhold=211 method=post enctype=multipart/form-data>
<table border=0 cellpadding=5 cellspacing=0>
<tr><td><Span style=font-size:12.5pt><b>Emne:</b></td><td><Span style=font-size:12.5pt><input type=text name=emne size=30></td></tr>
<tr><td align=top><Span style=font-size:12.5pt><b>Besked:</b></td><td><Span style=font-size:12.5pt><textarea cols=50 rows=10 name=tekst></textarea></td></tr>
<tr><td align=top><Span style=font-size:12.5pt><b>Vedhæft:</b></td><td><Span style=font-size:12.5pt><input type=file name=vedhaeft_fil></td></tr>
<tr><td></td><td><input type=submit value=Send!></td></tr>
</table>
</form>
";
}
håber der er nogle der kan hjælpe
Indlæg senest redigeret d. 11.11.2010 17:39 af Bruger #16254