CakePHP ForceDownload Component
Important! This is old code. I’ve not used it for a long time. It might still be useful. Be careful.
This snippet is a CakePHP component which can be used to force a users browser to download a specified file instead of attempting to display it. It will happily deal with any file your scripts have read access to. When provided with an absolute file location and filename for the downloaded file, it will attempt to look up an appropriate mime-type for the file, output some HTTP headers followed by the file data itself.
Read More