Próbuje wysłać załącznik po przez funkcję mail(), jednak do mnie wiadomość bez załącznika.
Kod poniżej
if ($_FILES["file"]["error"] > 0)
{ $komunikat = "<img src=\"img_panel/bttn_error.gif\">"."Return Code: " . $_FILES["file"]["error"] ;
}
if (file_exists("zalacznik/" . $_FILES["file"]["name"]))
{
$komunikat = "<img src=\"img_panel/bttn_error.gif\">"."Return Code: " . $_FILES["file"]["name"] . " already exists. " ;
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"zalacznik/" . $_FILES["file"]["name"]);
$komunikat = "<img src=\"img_panel/bttn_info.gif\">" . "zalacznik/" . $_FILES["file"]["name"];
$target_path="zalacznik/" . $_FILES["file"]["tmp_name"];////ścieżka do pliku
$nazwapliku= $_FILES["file"]["name"];
$content= chunk_split(base64_encode(file_get_contents($target_path)));
$uid= md5(uniqid(time()));
$tresc = $_POST['tresc'];
$temat = $_POST['tytul'];
$naglowki = "From: <[email protected]>\n";
$naglowki .= "MIME-Version: 1.0\n";
$naglowki .= "Content-type: multipart/mixed; boundary=\"".$uid."\"\n";
$naglowki .= "---".$uid."\n";
$naglowki .="Content-type: text/html charset=iso-8859-2\n";
$naglowki .="Content-Transfer-Encoding: 7bit \n";
$naglowki .= $tresc."\n";
$naglowki .= "---".$uid."\n";
$naglowki .="Content-type: image/png; name=\"".$nazwapliku. "\"\n";
$naglowki .="Content-Transfer-Encoding: base64 \n";
$naglowki .= "Content-Dispositing: attachment, fie=\"".$nazwapliku."\"\n";
$naglowki .= $content."\n";
if( mail("[email protected]",$temat,"", win2iso($naglowki))){
$komunikat = "<img src=\"img_panel/bttn_info.gif\">plik został wysłany";
}
else
$komunikat = "<img src=\"img_panel/bttn_error.gif\"> wysyłanie się nie powiodło";
//$zalacznik= chunk_split(base64_encode(file_get_contents($target_path)));
}
W mailu dostaję wszystko to co jest w nagłówku, bez załącznika. Ten kod pisałem na podstawie tutorialu
Gdzie jest błąd ?