I am trying to force downloading a pdf file using media views.
In my controller I added
function download () {
$this->view = 'Media';
$params = array(
'id' => 'example.pdf',
'name' => 'example',
'download' => true,
'extension' => 'pdf',
'path' => APP . 'files' . DS,
);
$this->set($params);
}
and in my view file (index.ctp) I have the following link
echo $html->link('download pdf',array( "action" => "download"));
Is there anything else I have to add or change because when I click the link
it gives me the error that the requested address was not found on this
server. It seems like it is looking for a view file for download.
Please help me figure out what is going on.
Thanks
--
View this message in context: http://cakephp.1045679.n5.nabble.com/force-download-using-Media-views-tp3238139p3238139.html
Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment