Fixed downloader maybe?
This commit is contained in:
parent
647c54e8d7
commit
57cf88deb9
|
|
@ -1,20 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
class EmailAttachmentsController extends AppController {
|
class EmailAttachmentsController extends AppController {
|
||||||
|
|
||||||
var $name = 'EmailAttachments';
|
var $name = 'EmailAttachments';
|
||||||
var $helpers = array('Html', 'Form');
|
var $helpers = array('Html', 'Form');
|
||||||
|
|
||||||
|
|
||||||
function download($id) {
|
function download($id) {
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
$file = $this->EmailAttachment->findById($id);
|
$file = $this->EmailAttachment->findById($id);
|
||||||
header('Content-type: ' . $file['EmailAttachment']['type']);
|
header('Content-type: ' . $file['EmailAttachment']['type']);
|
||||||
header('Content-length: ' . $file['EmailAttachment']['size']);
|
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();
|
ob_clean();
|
||||||
flush();
|
flush();
|
||||||
readfile($file['EmailAttachment']['filename']);
|
readfile($file['EmailAttachment']['filename']);
|
||||||
exit();
|
// echo $file['EmailAttachment']['filename']
|
||||||
}
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue