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"
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.
i tried html_entity_decode($filename)
but that didnt help..
this is the only code i can see it modifying filename before sending email
chunk_split(base64_encode(file_get_contents("$filename")));
heres the whole code anyway:
$filename = "./folder1/".$contextUser.".xls";
$strHeader .= "MIME-Version: 1.0
";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"
";
$strHeader .= "This is a multi-part message in MIME format.
";
$strHeader .= "--".$strSid."
";
$strHeader .= "Content-type: text/html; charset=windows-874
"; // or UTF-8 //
$strHeader .= "Content-Transfer-Encoding: 7bit
";
$strHeader .= $strMessage."
";
$strContent1 = chunk_split(base64_encode(file_get_contents("$filename")));
$strHeader .= "--".$strSid."
";
$strHeader .= "Content-Type: application/octet-stream; name=\"$filename\"
";
$strHeader .= "Content-Transfer-Encoding: base64
";
$strHeader .= "Content-Disposition: attachment; filename=\"$filename\"
";
$strHeader .= $strContent1."
";