cmc-sales/app/views/attachments/view.ctp

18 lines
594 B
Plaintext
Raw Normal View History

<?php if (file_exists($attachment['Attachment']['file'])) {
2012-11-18 12:19:55 -08:00
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($attachment['Attachment']['filename']));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($attachment['Attachment']['file']));
2012-11-18 12:19:55 -08:00
ob_clean();
flush();
readfile($attachment['Attachment']['file']);
2012-11-18 12:19:55 -08:00
exit;
}
?>