$path = BASE_URL."/pdf/";
$filename= $path.basename($_GET['download_file']);
header("Cache-Control: public");
header("Content-Description: File Transfer");
header('Content-disposition: attachment;
filename='.basename($filename));
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
header('Content-Length: '. filesize($filename));
readfile($filename);
exit;
這段代碼有效,但是我在打開下載的pdf時收到了Error in reading pdf file
。在上面的代碼中,我得到的位置http://localhost//eec//pdf/CV_Prabin Mishra.pdf
在php下載pdf的文件代碼