2009-02-09 14:25:49 -08:00
|
|
|
<?php
|
|
|
|
|
class EmailAttachmentsController extends AppController {
|
|
|
|
|
|
|
|
|
|
var $name = 'EmailAttachments';
|
|
|
|
|
var $helpers = array('Html', 'Form');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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'].'"');
|
2010-03-22 23:54:15 -07:00
|
|
|
ob_clean();
|
|
|
|
|
flush();
|
|
|
|
|
readfile($file['EmailAttachment']['filename']);
|
2009-02-09 14:25:49 -08:00
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|