-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspringsummer_download.php
More file actions
31 lines (25 loc) · 1015 Bytes
/
springsummer_download.php
File metadata and controls
31 lines (25 loc) · 1015 Bytes
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);
?>