http://blog.roodo.com/jaceju/archives/805389.html

php code:
$file_name = "file.name";
$file_path = "/path/to/realfile";
$file_size = filesize($file_path);
header('Pragma: public');
header('Expires: 0');
header('Last-Modified: ' . gmdate('D, d M Y H:i ') . ' GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Type: application/octet-stream');
header('Content-Length: ' . $file_size);
header('Content-Disposition: attachment; filename="' . $file_name . '";');
header('Content-Transfer-Encoding: binary');
readfile($file_path);

創作者介紹
創作者 wenching520 的頭像
wenching520

牧羊人

wenching520 發表在 痞客邦 留言(0) 人氣()