accord to:
http://renoir.vill.edu/~ylee/mailfile.html
I'd rewrite it easily
<head>
<title>PHPMail</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#33CC33" vlink="#33CC33" alink="#33CC33">
<?php
echo "File name=".$filename_name."<BR>\n";
echo "File size=".$filename_size." bytes<BR>\n";
echo "File type=".$filename_type."<BR>\n";
if (is_readable($filename)) {
$fd = fopen($filename, "r");
$contents = fread($fd, filesize($filename));
$stmp = $contents;
$len = strlen($stmp);
$out = "";
while ($len > 0) {
if ($len >= 76) {
$out = $out . substr($stmp, 0, 76) . "\r\n";
$stmp = substr($stmp, 76);
$len = $len - 76;
}
else {
$out = $out . $stmp . "\r\n";
$stmp = ""; $len = 0;
}
}
$contents = $stmp;
fclose($fd);
}
mail("$to","$subject",
"
--Attached==
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
$msg"."
--Attached==
Content-Type: $filename_type; name=\"$filename_name\"
Content-Disposition: attachment;
filename=\"$filename_name\"
Content-Transfer-Encoding: base64
".
$contents
."
--Attached==--
"
,
"From: ${from}
Reply-To: ${from}
X-Mailer: PHP_VAT
Content-Type: multipart/mixed; boundary=Attached==
");
?>
Mail SENT successfully!!
</body>
for attach detail, I would suggest you try to view a source mail in Linux, that would tell you a lot secrets!!