Dobijam sve sem attachmenta - tacan zaiv fajla, -----Inline Attachment Follows----- ali slike nigde samo objkat scr
Iz attachment ne dobijam 'filename' a 'name', 'type' dobijam
evo koda koji testiram
<?php
function formaAtt($attashment=""){
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" enctype="multipart/form-data" name="posalji">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="attachment" type="file" /></td>
<td><input name="potvrdi" type="submit" value="potvrdi" /></td>
</tr>
</table>
</form>
<?php
}
function slanjeEmaila($attachment){
$emailTelo = "Uz ovu poruku bi trebalo da ima attachment";
$emailZa = "[email protected]";
$emailOd = "[email protected]";
$emailNaslov = "e-Mali system v3.0 by IDD Lab";
$emailPredmet = "Proba slanja emaila v3";
$emailHeader = "From: $emailNaslov <$emailOd>\r\nReply-To: $emailOd\r\n";
$emailHeader .= "MIME-Version: 1.0\r\n";
$emailHeader .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDRY\"\r\n";
$emailPoruka = "--MIME_BOUNDRY\r\n";
$emailPoruka .= "Content-type: text/html; charset=utf-8\r\n";
$emailPoruka .= "\r\n";
$emailPoruka .= $emailTelo;
$emailPoruka .= "\r\n";
$filename = $attachment['filename'];
$name = $attachment['name'];
$type = $attachment['type'];
$file_url = 'http://www.iddlab.com/garman/tmp/' . $filename;
$fp = fopen($file_url,"rb");
$attachment = fread($fp, filesize($file_url));
$attachment = chunk_split(base64_encode($attachment));
$emailPoruka .= "--MIME_BOUNDRY\r\n";
$emailPoruka .= "Content-Type: $type ; name=\"$name\"\r\n";
$emailPoruka .= "Content-disposition: attachment\r\n";
$emailPoruka .= "Content-Transfer-Encoding: base64\r\n";
$emailPoruka .= "\r\n";
$emailPoruka .= "$attachment\r\n";
$emailPoruka .= "\r\n";
$emailPoruka .= "--MIME_BOUNDRY--\r\n";
echo "filename: ".$filename . '<br/>';
echo "name: ".$name . '<br/>';
echo "file type: " .$type. '<br/>';
echo "file url: ".$file_url. '<br/>';
mail($emailZa, $emailPredmet, $emailPoruka, $emailHeader);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Attachmenta</title>
</head>
<body>
<?php
if(!isset($_POST['potvrdi'])){
formaAtt();
}else{
$attachment=$_FILES["attachment"];
$putanja="tmp/". $_FILES["attachment"]["name"];
move_uploaded_file($_FILES["attachment"]["tmp_name"], $putanja);
slanjeEmaila($attachment);
}
?>
</body>
</html>
Sto se tice putanje $file_url = 'http://www.iddlab.com/garman/tmp/' - stavljao sam i $file_url = 'tmp/'
Ako neko meze neka pomogne, oci mi ispadose...
Hvala unapred