ดาวน์โหลดไฟล์ ของ php ทำไงหรอคับลองมาหลาบเวปแล้วยังไม่ได้เลยอะคั
define('DOCUMENT_FOLDER','docs/');
// add .pdf file extension
$filename=$_GET['iddow'];
$body='<h1>Download file '.$filename.'</h1>';
// get filename to download from DOCUMENTFOLDER or select from database
$file=DOCUMENTFOLDER.$filename;
$body.='<p>Start downloading file <strong>'.$filename.'</strong></p>';
if (fileexists($file) && isfile($file)) {
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$filename.'"');
readfile($file);
} else {
$body.='<p class="error">Download file <strong>'.$filename.'</strong> not found.</p>';
}
ดูให้ที่นะคับ ขอบคุณคับ
อันนี้ได้แน่นอนคับ ผมไปเจอในบทความ เอามาแก้ไขเล็กน้อยแล้วนำมาใช้ดู สรุปว่าใช้ได้คับ