$path = "../tv2.exe"; //路徑及下載的檔案
$name = "tv3.exe"; //下載後的檔名
if (!file_exists($path))
echo "錯誤";
else {
header("Content-type: application/download");
header("Content-Disposition: attachment; filename=$name");
header("Content-Transfer-Encoding: binary");
readfile($path);
}
?>
$path 還可以跨過 /var/www/html 到上一層:/var/www
沒有留言:
張貼留言