J'ai un peu de temps alors j'ai adapté le code vite fait (j'espère ne rien avoir oublié)
Tout d'abord, pour le formulaire, tu as oublié de fermer des balises </TR></TD>, et des guillemets aussi. J'ai apporté qq petites modifs à ton code:
<FORM enctype="multipart/form-data" action="./mail4.php" method="post">
<FIELDSET STYLE="background: #FFFFDD ;">
<LEGEND STYLE="background: #E5F5EE ;" <b>Complément de demande :</b></LEGEND>
<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="10" WIDTH="95%">
<TR>
<TD WIDTH="70%">Précisions ou informations concernant votre demande :<br>
<textarea name="Autres" cols="100" rows="3"></textarea>
<br><br>Nous joindre un fichier (Plans, photo...) :
<input type="file" name="fichier" />
</TD>
</TR>
</TABLE>
</FIELDSET><br><br>
<CENTER>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="10" WIDTH="95%">
<TR>
<TH>
<INPUT TYPE="SUBMIT" VALUE=" Soumettre formulaire ">
<INPUT TYPE="RESET" VALUE=" Effacer ">
</TH>
</TR>
</TABLE>
</CENTER>
</FORM>
pour le fichier mail4.php:
<html>
<body>
<center>
<?
$name_file = $_FILES['fichier']['name'];
$source=$_FILES['fichier']['tmp_name'];
move_uploaded_file($source, "./".$name_file);
$extension=get_extension($name_file);
$type="text/plain";
if($type=="doc")
{
$type="text/vnd.ms-word";
}
else if($type=="xls")
{
$type="text/vnd.ms-excel";
}
$type2="image/png";
if($extension=="gif")
{
$type2="image/gif";
}
else if($extension=="bmp")
{
$type2="image/bmp";
}
function get_extension($filename)
{
$parts = explode('.',$filename);
$last = count($parts) - 1;
$ext = $parts[$last];
return $ext;
}
//----------------------------------
// Construction de l'entête
//----------------------------------
$boundary = "-----=".md5(uniqid(rand()));
$header = "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$header .= "\r\n";
$msg = "Je vous informe que ceci est un message au format MIME 1.0 multipart/mixed.\r\n";
$msg .= "--$boundary\r\n";
$msg .= "Content-Type: $type; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding:8bit\r\n";
$msg .= "\r\n";
$msg .= $_POST['Autres'];
$msg .= "\r\n";
if($name_file!="")
{
$file = $name_file;
$fp = fopen($file, "rb");
$attachment = fread($fp, filesize($file));
fclose($fp);
$attachment = chunk_split(base64_encode($attachment));
$msg .= "--$boundary\r\n";
$msg .= "Content-Type: $type2; name=\"$file\"\r\n";
$msg .= "Content-Transfer-Encoding: base64\r\n";
$msg .= "Content-Disposition: inline; filename=\"$file\"\r\n";
$msg .= "\r\n";
$msg .= $attachment . "\r\n";
$msg .= "\r\n\r\n";
$msg .= "--$boundary--\r\n";
}
$destinataire = "toto@tata.fr";
mail($destinataire, "le sujet", $msg, $header);
if($name_file!="")
{
unlink($name_file);
}
print("<br>\n");
print("<br><A href=./mail3.php target=\"principal\"><font size=\"2\">Envoyer un autre mail</font></A>");
?>
</center>
</body>
</html>
GoOgle est ton ami ;o)