
31.08.2006, 21:48
|
|
Banned
Регистрация: 01.08.2006
Сообщений: 725
Провел на форуме: 7681825
Репутация:
4451
|
|
Смотри,допустим ты передаешь имя файла через POST
PHP код:
if isset($_POST['file'])
{
$pathtofile = $_POST['file'];
$mfile = fopen($pathtofile,"r");
if (!$mfile) die ("file $pathtofile cannot be open);
$file = fread($mfile,filesize($pathtofile);
fclose($mfile);
$bound = "--".md5(uniqid(time()));
$bound .= "MIME-VERSION": 1.0\n";
$headr .= "Content-Type: multipart/mixed; boundary=\"$bound\"\n";
$multip .= "--$bound\n\";
$multip .= "Content-Type: text/html; charset: koi8-r\n";
$multip .= "Content_transfer-Encoding: Quot-Printed\n\n\";
$multip .= "it is my message\n\n";
$msg = "Content-Type: aplication/octet-stream";
$msg .= "; file name= \"$pathtofile\"\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content_disposotion: attachement; filename = \"".$pathtofile."\"\n\n";
$msg .= chunk_split(base64_encode($file))."\n";
$multip .= "--$bound\n".$msg."--$bound--\n";
if (mail("ge@ma.ru","subject",$multip,$headr)) echo "sent";
}
|
|
|