attach file problem.
| From: | arthur | Date: | Wed, 01 Aug 2001 15:18:29 +0000 |
| Subject: | attach file problem. | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-8616@lists.php.net to get a copy of this message | ||
Hello,
I'm using mail to attach a file but I'm having a problem. My script works really good but
when I send an attachment the file goes currupt. I don't know if the problem is the
encoded_attach or enything else. Hope someone can help me.
Here goes a part of my script that I add the attachment.
Thanks
Arthur Franco
if ($attach != "none")
{
$file = fopen($attach, "r");
$contents = fread($file, $attach_size);
$encoded_attach = chunk_split(base64_encode($contents));
fclose($file);
$Headers .= "MIME-version: 1.0\n";
$Headers .= "Content-type: multipart/mixed; ";
$Headers .= "\nContent-Type:text/html";
$Headers .= "boundary=\"Message-Boundary\"\n";
$Headers .= "Content-transfer-encoding: 7BIT\n";
$Headers .= "X-attachments: $attach_name";
$Headers .= "Content-type: $attach_type;
name=\"$attach_name\"\n";
$Headers .= "Content-Transfer-Encoding:base64_encode\n";
$Headers .= "Content-disposition: attachment;
filename=\"$attach_name\"\n\n";
$Headers .= "$encoded_attach\n";
}