You probably have a fatal php error. Check your server's logs.
On Thu, Feb 7, 2013 at 5:32 AM, Victor Musvibe <jaahvicky@gmail.com> wrote:
> I am trying to download a file thats already uploaded in cakephp app folder.
> I am using the function below in my controller but it just opens a blank
> page without even downloading the file
>
> public function download($id = null) {
> $this->viewClass = 'Media';
> // Download app/outside_webroot_dir/example.pdf
> $adminProcedure = $this->AdminProcedure->findById($id);
> $filename = $adminProcedure['AdminProcedure']['filename'];
> $this->request->params = array(
> 'id' => $adminProcedure['AdminProcedure']['id'],
> 'name' => substr($filename, 0, strrpos($filename, '.')),
> 'extension' => substr(strrchr($filename, '.'), 1),
> 'ext'=>'pdf',
> 'download' => true,
> 'path' => APP.'admin_procedures'.DS,
> );
> $this->set($params);
> }
>
>
> In my view i have used this bit of code to link to the file im trying to
> download.
>
> ?php echo $this->Html->link(__('Download', true), array('action' =>
> 'download', $adminProcedure['AdminProcedure']['id'])); ?>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscribe@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Thursday, February 7, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment