PHP2008. 10. 27. 15:44

if(eregi("(MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)) {
    Header("Content-type:application/octet-stream");
    Header("Content-Length:".filesize($Path));
    Header("Content-Disposition:attachment;filename=".$user_file);
    Header("Content-Transfer-Encoding:binary");
    Header("Pragma:no-cache");
    Header("Expires:0");
} else {
    Header("Content-type:file/unknown");
    Header("Content-Length:".filesize($Path));
    Header("Content-Disposition:attachment; filename=".$user_file);
    Header("Content-Description:PHP3 Generated Data");
    Header("Pragma: no-cache");
    Header("Expires: 0");
}

if (is_file($Path)) {
    $fp = fopen($Path, "rb");
    if (!fpassthru($fp)) fclose($fp);
    clearstatcache();
} else {
    echo "해당 파일이나 경로가 존재하지 않습니다.";
}

Posted by 아마데우스