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