Io ho fatto così:

<FORM ENCTYPE=\"multipart/form-data\" NAME=\"form_messaggio\" METHOD=\"post\" ACTION=\"invia_messaggio.php\">
......

<TEXTAREA NAME=\"msg\" ROWS=\"4\" COLS=\"40\" WRAP=\"physical\"></TEXTAREA>
<INPUT TYPE=\"file\" NAME=\"allegato\">
........

in invia_messaggio.php, poi:


$messaggio = "--XX-1234DED00099A\n";
$messaggio .= "Content-Type: text/plain; charset=iso-8859-1\n";
$messaggio .= "Content-Transfer-Encoding: 7bit\n";
$messaggio.= "$msg\n\r";

$messaggio.="--XX-1234DED00099A\n";
$messaggio.="Content-Type: $tipo_file; name=$allegato_name\n";
$messaggio.="Content-Transfer-Encoding: base64\n";
$messaggio.="Content-Description: Nuovo file\n";
$messaggio.="Content-Disposition: attachment; filename=$allegato_name\n\n";

$fp=@fopen($allegato_name, "r");

if ($fp) $data = fread($fp, filesize($allegato_name));

$curr = chunk_split(base64_encode($data));

fclose($fp);

$messaggio .= "$curr\n--XX-1234DED00099A--\n";

$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=XX-1234DED00099A\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
$headers .= "From: PROVA@libero.it\n";


@mail("DESTINATARIO", "OGGETTO DELLA EMAIL", $messaggio, $headers);

a me funziona!