Linking to a file (e.g. PDF) within a CakePHP view.

Posted by Hobonium on Stack Overflow See other posts from Stack Overflow or by Hobonium
Published on 2008-10-24T14:00:34Z Indexed on 2010/03/30 14:43 UTC
Read the original article Hit count: 192

Filed under:

I'd like to link to some PDFs in one of my controller views. What's the best practice for accomplishing this? The CakePHP webroot folder contains a ./files/ subfolder, I am confounded by trying to link to it without using "magic" pathnames in my href (e.g. "/path/to/my/webroot/files/myfile.pdf").

What are my options?

EDIT: I didn't adequately describe my question. I was attempting to link to files in /app/webroot/files/ in a platform-agnostic (ie. no mod_rewrite) way.

I've since worked around this issue by storing such files outside the CakePHP directory structure.

© Stack Overflow or respective owner

Related posts about cakephp