开发者

cakePHP - Download File through Controller

I'm using the cakePHP framework for my website and I would like to create an action which, rather than sending HTML, instead echos the contents of a file. It can't be stored in a public directory, as the data is confidential.

Before using the framework, I accomplished this by rewriting /downloads/KEY/FILE to file.php?key=KEY&file=FILE

However, I can't find any clear way to do this using cakePHP. Essentially, I'd like a way to either:

  1. When a user accesses a controller action from its URL a .jar file is sent, not a webpage.

  2. A URL is redirected to a PHP file which separately connects to a database and serves the file.

Note that cakePHP is at my domain ro开发者_如何学Pythonot. Also, as I'm using SSL for the transfer and I do not ow n a wildcard certificate, I cannot use a subdomain.


use Media view: http://book.cakephp.org/view/1094/Media-Views

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜