cmc-sales/controllers/email_attachments_controller.php
Karl Cordes 4347aee5f0 Changes
2009-11-04 17:12:12 +11:00

19 lines
537 B
PHP
Executable file

<?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'].'"');
echo $file['EmailAttachment']['data'];
exit();
}
}