Hallo an alle,
Ich habe ein Formular mit mail Anhang das auch functionniert mit einer .txt Datei, jedoch möchte ich word dokumente verschicken aber dies fonktionniert nicht kann mir jemand helfen?
Hier mein Script:
if(is_uploaded_file($_FILES[„file“][„tmp_name“]) ){
$inFile = $_FILES[„file“][„tmp_name“];
$outFile = „c:\php\upload\“ . $_FILES[„file“][„name“];
(copy($inFile, $outFile));
$subject = „Test attachment“;
$from = „[email protected]“;
$to = „[email protected]“;
$message = „Cv déposez.“;
$boundary = strtoupper(md5(uniqid(time())));
$mail_header = „MIME-Version: 1.0“;
$mail_header .= „\nContent-Type: multipart/mixed; boundary=“.$boundary;
$mail_header .= „\n\nThis is a multi-part message in MIME format – Dies ist eine mehrteilige Nachricht im MIME-Format“;
$mail_header .= „\n–“.$boundary;
$mail_header .= „\nContent-Type: text/plain“;
$mail_header .= „\nContent-Transfer-Encoding: 8bit“;
$mail_header .= „\n\n“.$message;
$contenu = fread(fopen($outFile,‚rb‘),$_FILES[‚file‘][‚size‘]);
$contenu = chunk_split(base64_encode($contenu));
$mail_header .= „\n–“.$boundary;
$mail_header .= „\nContent-Type: application/x-word; name=“.$outFile;
$mail_header .= „\nContent-Transfer-Encoding: base64“;
$mail_header .= „\nContent-Disposition: attachment; filename=“.$outFile;
$mail_header .= „\n\n“.$contenu;
$mail_header .= „\n–“.$boundary."–";
mail($to,$subject,"",$mail_header);
unlink($outFile);
}
?>