Fixed downloader maybe?

This commit is contained in:
Karl Cordes 2010-04-27 16:49:20 +10:00
parent 647c54e8d7
commit 57cf88deb9

View file

@ -5,15 +5,16 @@ class EmailAttachmentsController extends AppController {
var $helpers = array('Html', 'Form');
function download($id) {
function download($id) {
Configure::write('debug', 0);
$file = $this->EmailAttachment->findById($id);
header('Content-type: ' . $file['EmailAttachment']['type']);
header('Content-length: ' . $file['EmailAttachment']['size']);
header('Content-Disposition: attachment; filename="'.$file['EmailAttachment']['name'].'"');
header('Content-Disposition: attachment; filename='.basename($file['EmailAttachment']['name']));
ob_clean();
flush();
readfile($file['EmailAttachment']['filename']);
// echo $file['EmailAttachment']['filename']
exit();
}