//$file_name : 실제 다운받을 파일이름.
$filepath="../data/".$file_name;
if(eregi("(MSIE 5.0|MSIE 5.1|MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)){
Header("Content-type: application/octet-stream");
Header("Content-Length: ".filesize($filepath));
Header("Content-Disposition: attachment; filename=$file_name");
Header("Content-Transfer-Encoding: binary");
Header("Pragma: no-cache");
Header("Expires: 0");
} else {
Header("Content-type: file/unknown");
Header("Content-Length: ".filesize($filepath));
Header("Content-Disposition: attachment; filename=$file_name");
Header("Content-Description: PHP3 Generated Data");
Header("Pragma: no-cache");
Header("Expires: 0");
}
$fp = fopen($filepath, "r");
if (!fpassthru($fp)) fclose($fp);
?>
Posted by 홍반장