파일다운로드 창 띄우기
페이지 정보
작성자 JMStudy 작성일06-09-14 21:41 조회8,994회 댓글0건본문
$file = $row[upfile1];
$dnfile = $row[upfile_path].$row[upfile1_1];
if(eregi("(MSIE 5.0|MSIE 5.1|MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT))
{
if(strstr($HTTP_USER_AGENT, "MSIE 5.5"))
{
header("Cache-control: private");
header("Content-Type: doesn/matter");
header("Content-disposition: filename=$file");
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
}
if(strstr($HTTP_USER_AGENT, "MSIE 5.0"))
{
header("Cache-control: private");
Header("Content-type: file/unknown");
header("Content-Disposition: attachment; filename=$file");
Header("Content-Description: PHP3 Generated Data");
header("Pragma: no-cache");
header("Expires: 0");
}
if(strstr($HTTP_USER_AGENT, "MSIE 5.1"))
{
header("Cache-control: private");
Header("Content-type: file/unknown");
header("Content-Disposition: attachment; filename=$file");
Header("Content-Description: PHP3 Generated Data");
header("Pragma: no-cache");
header("Expires: 0");
}
if(strstr($HTTP_USER_AGENT, "MSIE 6.0"))
{
header("Cache-control: private");
Header("Content-type: application/x-msdownload");
Header("Content-Length: ".(string)(filesize("$dnfile")));
Header("Content-Disposition: attachment; filename=$file");
Header("Content-Transfer-Encoding: binary");
Header("Pragma: no-cache");
Header("Expires: 0");
}
} else {
header("Cache-control: private");
Header("Content-type: file/unknown");
Header("Content-Length: ".(string)(filesize("$dnfile")));
Header("Content-Disposition: attachment; filename=$file");
Header("Content-Description: PHP3 Generated Data");
Header("Pragma: no-cache");
Header("Expires: 0");
}
if (is_file("$dnfile")) {
$fp = fopen("$dnfile", "rb");
if (!fpassthru($fp)){
fclose($fp);
}
} else {
echo "해당 파일이나 경로가 존재하지 않습니다.";
}
댓글목록
등록된 댓글이 없습니다.