-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_download.php
31 lines (25 loc) ยท 1015 Bytes
/
board_download.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$real_name = $_GET["real_name"];
$file_name = $_GET["file_name"];
$file_type = $_GET["file_type"];
$file_path = "./data/".$real_name;
$ie = preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) ||
(strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0') !== false &&
strpos($_SERVER['HTTP_USER_AGENT'], 'rv:11.0') !== false);
//IE์ธ๊ฒฝ์ฐ ํ๊ธํ์ผ๋ช
์ด ๊นจ์ง๋ ๊ฒฝ์ฐ๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํ ์ฝ๋
if( $ie ){
$file_name = iconv('utf-8', 'euc-kr', $file_name);
}
if( file_exists($file_path) )
{
$fp = fopen($file_path,"rb");
Header("Content-type: application/x-msdownload");
Header("Content-Length: ".filesize($file_path));
Header("Content-Disposition: attachment; filename=".$file_name);
Header("Content-Transfer-Encoding: binary");
Header("Content-Description: File Transfer");
Header("Expires: 0");
}
if(!fpassthru($fp))
fclose($fp);
?>