GORAGOD.com

freelance, web developer, web designer, hosting, domain name

ดาวน์โหลดไฟล์ ของ 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>';

}



ดูให้ที่นะคับ ขอบคุณคับ

18 ม.ค. 2556 1 1,599

http://www.goragod.com/knowledge/%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B8%A5%E0%B8%B4%E0%B8%87%E0%B8%84%E0%B9%8C%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A%E0%B8%94%E0%B8%B2%E0%B8%A7%E0%B8%99%E0%B9%8C%E0%B9%82%E0%B8%AB%E0%B8%A5%E0%B8%94%E0%B9%84%E0%B8%9F%E0%B8%A5%E0%B9%8C.html

อันนี้ได้แน่นอนคับ ผมไปเจอในบทความ เอามาแก้ไขเล็กน้อยแล้วนำมาใช้ดู สรุปว่าใช้ได้คับ
#1
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 2M
^