Thursday, December 30, 2010

Re: Downloadable files without mod_rewrite

On Thu, Dec 30, 2010 at 10:28 AM, WhyNotSmile <sharongilmore78@gmail.com> wrote:
> I'm trying to create a link on my page to download a file.  However,
> the server won't let me use mod_rewrite, and I'm having problems
> getting the download to work.  I googled the problem, and made some
> progress.
>
> So far, I have:
>
> In the view, the link to download the file is:
>
>    <?php echo $this->Html->link('Download File', '/downloads/
> download', array('class' => 'bluelink'));?>
>
> I have a controller called downloads_controller.php which contains:
>
> <?php
> class DownloadsController extends AppController {
>
>  function download () {
>  $this->view = 'Media';
>  $params = array(
>   'id' => 'constition.pdf', // hard-coded for now
>   'name' => 'constitution',
>   'download' => true,
>   'extension' => 'pdf',
>   'path' => APP . 'files' . DS
>  );
>  $this->set($params);
>  }
> }
>
> The file is in the directory 'app/files'.
>
> When I click on the link in the view I get:
>
>     Not Found
>
>     Error: The requested address '/downloads/download' was not found
> on this server.
>
> Does anyone have any ideas as to what else I should be doing?

Set debug to 2 in core.php. Cake throws a 404 when it encounters an
error and is in production mode.

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: