ie8까지 첨부 다운로드받을때 다운로드할수없는경우에 팁

· 13년 전 · 5028
download.php 를 수정합니다.

4번라인에
function download_header($filename, $mode = "write", $filepath = "") {
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$filename = rawurlencode($filename);
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
}

header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: application/octet-stream");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
if ($mode == "write") {
$file_size = 0;
}
else {
header("Content-Length: " .(string)(filesize($filepath)));
}


header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
flush();

}
를 추가합니다.

if(preg_match("/msie/i", $_SERVER[HTTP_USER_AGENT]) && preg_match("/5\.5/", $_SERVER[HTTP_USER_AGENT])) {
header("content-type: doesn/matter");
header("content-length: ".filesize("$filepath"));
header("content-disposition: attachment; filename=\"$original\"");
header("content-transfer-encoding: binary");
} else {
header("content-type: file/unknown");
header("content-length: ".filesize("$filepath"));
header("content-disposition: attachment; filename=\"$original\"");
header("content-description: php generated data");
}
header("pragma: no-cache");
header("expires: 0");
flush();
부분을 주석처리또는 삭제하고
download_header($original, "", $filepath);
를 추가합니다.

첨부파일

download.php (4.5 KB) 59회 2012-09-13 17:13
|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요. 나누면 즐거움이 커집니다.

+
제목 글쓴이 날짜 조회
13년 전 조회 4,185
13년 전 조회 3,009
13년 전 조회 1만
13년 전 조회 5,415
13년 전 조회 3,723
13년 전 조회 8,227
13년 전 조회 6,687
13년 전 조회 8,278
13년 전 조회 5,643
13년 전 조회 5,029
13년 전 조회 4,079
13년 전 조회 6,657
13년 전 조회 3,035
13년 전 조회 6,067
13년 전 조회 4,469
13년 전 조회 6,119
13년 전 조회 3,854
13년 전 조회 4,094
13년 전 조회 7,079
13년 전 조회 1.6만
🐛 버그신고