Thursday, July 28, 2011

RE: Media Views

If i recall correctly you need to set the mimetype as well.

Add the line below and let me know if it helps.

'mimeType' => array('pdf' => 'application/pdf'),

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of UprightDog
Sent: Thursday, July 28, 2011 8:08 PM
To: CakePHP
Subject: Media Views

I'm trying to get Media Views up and running, to download PDFs. I'm on
a completely new and fresh CakePHP install. This is my action:

function download() {
$this->autoRender = false;
$this->view = 'Media';
$params = array(
'id' => 'test.pdf',
'name' => 'test',
'download' => true,
'extension' => 'pdf',
'path' => APP . 'files' . DS
);
$this->set($params);
}

However, the result is just a blank screen. The file definitely exists
in the right spot.

What am I missing?

--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


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

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: