สอบถามการกำหนด header php

ผมกำหนด header ในไฟล์ download.php




// Send file headers


header("Cache-Control: no-store, no-cache, must-revalidate");


header("Cache-Control: post-check=0, pre-check=0", false);    


header("Content-type: $ctype");


header("Content-Disposition: attachment;filename=$rename");


header("Content-Transfer-Encoding: binary");


header("Content-Length: ".@filesize($file));


header('Pragma: no-cache');


header('Expires: 0');


 


// Send the file contents.


readfile($file) or die("File not found.");




รูปแบบ link จะเป็น download.php?paskey=bv73zu495dpszcv6946k7fgmfscbawrb



แต่พอดาวน์โหลดมาแล้วขนาดไฟล์เป็น 0 Bytes

ถ้าดาวน์โหลด link ตรง (www.xxx.com/ชื่อไฟล์) ก็ได้ขนาดปกติ 

สงสัยว่าต้องกำหนด header ยังไงครับ

09 ก.พ. 2555 2 1,946

#1

ขอบคุณครับ แต่ก็ยังไม่ได้ เป็นกับบางไฟล์บางไฟล์ดาวน์โหลดได้ปกติ บางไฟล์ดาวนืโหลแล้วเป้น 0 bytes งงหนักเลย
#2
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^