0
我想下载一个PDF文件:下载大小不指定
$output = RP_MAIN . 'docbook/data/myfile' . $_SESSION["sess_code_user"] . '.pdf'; // this is the pdf file I want to download
$file_size = filesize($output);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: text/enriched");
header("Content-length: $file_size");
header('Content-Disposition: attachment; filename="'.'manuel.'. $extension .''.'"');
ob_clean();
flush();
print($output);
exit();
的PDF文件存在于系统中,它具有25 KB的大小。但问题是下载弹出窗口(Internet下载管理器)在大小字段中有一个空白字段。
我的代码有什么问题?我该如何解决这个问题?
编辑: 从一个Ajax调用创建的PDF文件,然后在阿贾克斯则开始下载成功:
var request = $.ajax({
data: donne,
type: "POST",
url: "<?php echo HTTP_AJAX_TACHE ?>TacheCreerPdfAjax.php" , // this creates the pdf file
async: false
});
request.done(function() {
$('#corps').html(request.responseText);
if(fichier == "pdf" || fichier == "rtf")
window.location.href = '<?php echo PAGE_TACHE ?>?action=TacheGenererManuelExec&fichier=' + fichier ; // this starts the download
...
}
所以启动下载时,则有一个错误,指出源的格式不是pdf!
没有,同样的问题:) – pheromix