【发布时间】:2012-12-14 06:54:03
【问题描述】:
filedownload.php 有以下片段。
$file = 'cut.png';
header("Content-Type: image/png");
header('Content-Disposition: attachment; filename="'.$file.'"');
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
readfile($file);
exit();
AJAX 调用
jQuery.post('filedownload.php',{
'file' : result // not used for the time being
});
我对@987654325@ 文件进行了ajax 调用。它不允许用户下载文件。但如果我直接运行 php,它允许用户下载文件。可能是什么问题 ?
我想使用核心功能而不是使用 jQuery 插件。如果不可能,一个插件就可以了。
鉴于我使用 ajax 因为页面无法刷新。
【问题讨论】:
标签: php jquery ajax file download