cakephp下载png文件

编程入门 行业动态 更新时间:2024-10-26 09:19:07
本文介绍了cakephp下载png文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我动态生成png文件,点击生成按钮后出现下链接。

I dynamically generate png files which after clicking "generate" button appears "under" link.

"generate button : click" ---> <a href="new_generated.png">DOWNLOAD</a>

点击链接后下载我希望链接的内容(在我的情况下png)开始下载 - 另一个窗口,但下载! 我使用cakePHP。

After clicking link DOWNLOAD I wish content of link(in my case png) start download - no open in another window but download! I am using cakePHP. Can I please for help?

推荐答案

或者,如果您使用Apache Web服务器并启用了mod_headers,您可以使用.htaccess文件强制下载png文件。

Alternatively if you are using Apache web server and have mod_headers enabled you can use an .htaccess file to force download of the png files.

创建一个.htacess文件,并将其放在正在生成/下载png文件的目录中。在该文件中输入:

Create a .htacess file and place it in the directory where your png files are being generated/downloaded from. In that file put this:

<FilesMatch "\.(?i:png)$"> ForceType application/octet-stream Header set Content-Disposition attachment </FilesMatch>

更多推荐

cakephp下载png文件

本文发布于:2023-07-27 00:23:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219217.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   cakephp   png

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!