Is base64_encode renaming my file before email send?
<p>I'm using phpexcel to create a file.xls and then this small code i picked up to email me the xls as attachment. the problem is it sends the xls attachment as filename = "._folder1_admin.xls" instead of the actual filename "admin.xls"</p>

<p>It works fine if i define $filename without a sub-directory. but once i use the sub-dir like: $filename = "./folder1/".$contextUser.".xls"; it screws up the filename in email.</p>

<p>i tried html_entity_decode($filename) but that didnt help..</p>

<p>this is the only code i can see it modifying filename before sending email</p>

<pre><code>chunk_split(base64_encode(file_get_contents("$filename")));
</code></pre>

<p>heres the whole code anyway:</p>

<pre><code>$filename = "./folder1/".$contextUser.".xls";
$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";
$strContent1 = chunk_split(base64_encode(file_get_contents("$filename")));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"$filename\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"$filename\"\n\n";
$strHeader .= $strContent1."\n\n";
</code></pre>
