我动态生成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文件
发布评论