1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
$Fichier = $_POST['Fichier'];
$ExtensionFile = substr($Fichier,-3);
if($ExtensionFile=="jpg"){
$ContentType = "image/jpeg";
}else if($ExtensionFile=="gif"){
$ContentType = "image/gif";
}else if($ExtensionFile=="bmp"){
$ContentType = "image/bmp";
}else if($ExtensionFile=="doc"){
$ContentType = "application/msword";
}else if($ExtensionFile=="xsl"){
$ContentType = "application/msexcel";
}else if($ExtensionFile=="pdf"){
$ContentType = "application/pdf";
}else if($ExtensionFile=="pps"){
$ContentType = "application/mspowerpoint";
}else if($ExtensionFile=="ppt"){
$ContentType = "application/mspowerpoint";
}else{
$ContentType = "text/plain";
}
$PieceJointe = "Content-Type: $ContentType; name=\"$Fichier\"\n";
$PieceJointe .= "Content-Transfer-Encoding: base64\n";
$PieceJointe .= "Content-Disposition:PieceJointe; filename=\"$Fichier\"\n\n";
$PieceJointe .= chunk_split(base64_encode($Fichier));
if($SendMail=="Oui"){
mail($destinataire,$TitreMail,$codehtml,$PieceJointe,"From: $expediteur\r\nReply-To: $reponse\r\nContent-Type: text/html; charset=\"iso-8859-1\"\r\n");
} |
Partager