PHP Download File in IE

October 29th, 2010

<?php

$filename = ‘file.txt’;
$contents = “”;

header(“Content-type: application/octet-stream”);
header(“Content-Type: application/force-download”);
header(“Content-Description: File Transfer”);
header(“Content-Type: application/download”);
header(‘Content-Disposition: attachment; filename=’.$filename);

$contents .= ‘Test Download File’;

echo $content;

?>

IE 不可以直接打網址(HTTP://WWW.XXX.COM/download.php)去下載file, 只能用link <a href=”./download.php”>Download</a>

PHP , ,