/**
* NFUpload - Ç÷¡½Ã ±â¹ÝÀÇ ¾÷·Îµå ÇÁ·Î±×·¡½º¹Ù°¡ Áö¿øµÇ´Â ¸ÖƼ¾÷·Îµå ÇÁ·Î±×·¥
*
* ¶óÀ̼¾½º : ÇÁ¸®¿þ¾î (°³ÀÎ/ȸ»ç ±¸ºÐ¾øÀÌ ¹«·á·Î »ç¿ë°¡´É)
* Á¦ÀÛ»ç : ÆнºÄÚ¸®¾Æ³Ý (http://passkorea.net/)
*
* ¹èÆ÷½Ã ÁÖÀÇ»çÇ× : Á¦ÀÛ»ç¿Í ¶óÀ̼¾½º Á¤º¸¸¦ »èÁ¦ÇÏ½Ã¸é ¾ÈµË´Ï´Ù.
*/
require_once('nfupload_conf.inc.php'); // NFUpload Config
// ÆÄÀÏ¸í º¸¾È Á¶Ä¡
function basename_fix($filename)
{
return preg_replace('/^.+[\\\\\\/]/', '', $filename);
} // function()
$_GET['tmp_name'] = basename_fix(stripslashes($_GET['tmp_name']));
$_GET['name'] = basename_fix(stripslashes($_GET['name']));
// ÆÄÀÏ Á¸Àç¿©ºÎ, Àб⠰¡´ÉÇÑÁö °Ë»ç
$file = $__NFUpload['dir'].DIRECTORY_SEPARATOR.$_GET['tmp_name'];
if (!file_exists($file))
{
?>
} else if (!is_readable($file))
{
?>
} else
{
$file_size = filesize($file);
$fp = fopen($file,"r");
$contents = fread($fp,$file_size);
fclose($fp);
if (!function_exists('mime_content_type_simple')) {
function mime_content_type_simple($filename) {
$idx = strtolower(end( explode( '.', $filename )) );
$mimet = array(
'ai' =>'application/postscript',
'aif' =>'audio/x-aiff',
'aifc' =>'audio/x-aiff',
'xyz' =>'chemical/x-xyz',
'zip' =>'application/zip',
'xls' =>'application/vnd.ms-excel',
'ppt' =>'application/mspowerpoint',
'doc' =>'application/msword',
'htm' =>'text/html',
'html' =>'text/html',
'eml' =>'message/rfc822',
'txt' =>'text/plain',
'pdf' =>'application/pdf',
'jpg' =>'image/jpeg',
'gif' =>'image/gif',
'png' =>'image/png',
'dwg' =>'application/acad',
'dxf' =>'application/dxf'
);
if (isset( $mimet[$idx] )) {
return $mimet[$idx];
} else {
return 'application/octet-stream';
}
}
}
$c_type = mime_content_type_simple($_GET['name']);
$__NFUpload['charset'] = "utf-8";
if (strstr($_SERVER['HTTP_USER_AGENT'],"MSIE") && strtolower($__NFUpload['charset']) == 'utf-8')
{
$_GET['name'] = iconv('utf-8//IGNORE', 'cp949', $_GET['name']);
} else if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
{
$_GET['name'] = str_replace(";", "%3B", $_GET['name']);
} // if()
$mtime = filemtime($file);
if (!$mtime)
$mtime = time();
header('Last-Modified: '.date('r', $mtime));
if ( strstr($_SERVER['HTTP_USER_AGENT'],"rv:11.0")){ //Àͽº 11¿¡¼¸¸ ÇѱÛÆÄÀÏ ´Ù¿î½Ã ±úÁüÇö»ó ¹æÁö
$_GET['name'] = iconv("utf-8","euc-kr",$_GET['name']);
}
if ( strstr($_SERVER['HTTP_USER_AGENT'],"MSIE 5.5"))
{
header("Content-Type: doesn/matter\r\n");
header("Content-Disposition: filename=\"".$_GET['name']."\"\r\n\r\n");
header("Content-Length: ".$file_size."\r\n");
header("Content-Transfer-Encoding: binary\r\n");
}else
{
header("Content-Type: $c_type\r\n");
header("Content-Disposition: attachment; filename=\"".$_GET['name']."\"\r\n\r\n");
header("Content-Length: ".$file_size."\r\n");
header("Content-Transfer-Encoding: binary\r\n");
} // if()
echo $contents;
} // if()
?>