Supportnet / Forum / Skripte(PHP,ASP,Perl...)
mail()-attachment Probleme !!
Frage
Hallo,
dieses Skript schickt eine eMail inkl. Attachment. Das funktioniert soweit auch wunderbar, ABER die Dateien sind leer. Sie haben zwar den richtigen Namen, aber immer die Größe von 0Byte, egal welcher Dateityp. Für mich heißt das, dass das Einlesen nicht klappt, oder liege ich da falsch?
Wer kann mirhelfen?
[code]
$dateinameY = getcwd()."/daten/".$HTTP_POST_FILES["attach"]["name"];
$dateinameY = stripslashes($dateinameY);
$contenttypes = array("application/*" => array("encoding"=>"base64","info"=>"Komprimiert: ZIP") );
$von=$MPH_User_Vorname." ".$MPH_User_Name." ".$MPH_User_E_MAIL;
echo 'file: '.$HTTP_POST_FILES["attach"]['tmp_name'];
$content_type="text/plain";
//copy($HTTP_POST_FILES["attach"]["tmp_name"],$dateinameY);
move_uploaded_file($_FILES['attach']['tmp_name'], $dateinameY);
//LOAD_FILE($dateinameY);
$datei_contentY = fread(fopen($dateinameY,"rb"),filesize($dateinameY));
$filename = $HTTP_POST_FILES["attach"]["name"];
//$datei_contentY = chunk_split(base64_encode($datei_contentY));
$datei_contentY = chunk_split(base64_encode(implode("", file($datei_contentY))));
$to=some@one.de';
$subject=balbla'';
$anhang_content_type="application/*";
$boundary = strtoupper(md5(uniqid(time())));
$mail_header = "From: $von\n";
$mail_header .= "MIME-Version: 1.0\n";
$mail_header .= "Content-Type: multipart/mixed; boundary=$boundary\n";
$mail_header .= "This is a multi-part message in MIME format -- Dies ist eine mehrteilige Nachricht im MIME-Format\n";
$mail_header .= "--$boundary\n";
$mail_header .= "Content-Type: $content_type\n";
$mail_header .= "Content-Transfer-Encoding: 8bit\n";
$mail_header .= "$oha_mailbody\n";
$mail_header .= "--$boundary\n";
echo "<br>".$dateinameY;
$mail_header .= "Content-Type: $anhang_content_type; name=\"$filename\"\n";
$mail_header .= "Content-Transfer-Encoding: ".$contenttypes[$anhang_content_type]["encoding"]."\n";
$mail_header .= "Content-Disposition: attachment; filename=\"$filename\"\n";
$mail_header .= "$datei_contentY\n";
$mail_header .= "--$boundary--\n";
$sent=mail($to, $subject,"", $mail_header);
fclose($dateinameY);
[/code]
Die Variable attach kommt aus einem Formular (type='file').
Danke.
Antwort 1 von Sloth
*** push ***
Antwort 2 von Sloth
Irgendein PHP-Profi hier?
Antwort 3 von Henry1967
Schau mal da nach
http://www.nukeforums.de/
http://www.nukeforums.de/

