public function setAttachment($attachmentName)
{
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$userAgent = $_SERVER['HTTP_USER_AGENT'];
if (Text::contains($userAgent, 'Trident') || Text::contains($userAgent, 'MSIE')) {
$attachmentName = urlencode($attachmentName);
}
}
$this->setHeader('Content-Description', 'File Transfer');
$this->setHeader('Content-Type', 'application/octet-stream');
$this->setHeader('Content-Disposition', 'attachment; filename=' . $attachmentName);
$this->setHeader('Content-Transfer-Encoding', 'binary');
$this->setHeader('Cache-Control', 'must-revalidate');
return $this;
}