<?define("_ITEMMANIA_", TRUE);
require_once("include/init.inc.php");
try{
$LimDB =& new DbConnection(new limDbConnection());
$LimDB->debug = false;
$bLimDB = $LimDB->Connect();
if($bLimDB == false) { throw new DBException("디비연결 오류!", ERR_BACK); }
$idx = $_GET["idx"];
$strQuery = "SELECT image_name,image FROM gallery1 WHERE id=".$idx;
$strRs = $LimDB->Execute($strQuery);
$filename = basename($strRs->fields[0]);
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch($file_extension)
{
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg": $ctype="image/jpeg"; break;
case "jpg": $ctype="image/jpg"; break;
case "mp3": $ctype="audio/mpeg"; break;
case "wav": $ctype="audio/x-wav"; break;
case "mpe": $ctype="video/mpeg"; break;
case "mov": $ctype="video/quicktime"; break;
case "avi": $ctype="video/x-msvideo"; break;
default: $ctype="file/unknown";break;
}
// header("Pragma: public");
// header("Expires: 0");
// header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// header("Cache-Control: public");
// header("Content-Description: File Transfer");
header("Content-Type: image/gif");
// header("Content-Disposition: attachment; filename=".mb_convert_encoding(str_replace(" ","",str_replace(";","",$strRs->fields[0])),"EUC-KR","UTF-8"));
// header("Content-Transfer-Encoding: binary");
echo $strRs->fields[1];
}catch(DBException $e)
{
if($LimDB && $LimDB->IsConnected())
{
$LimDB->dbClose($LimDB);
}
unset($LimDB);
echo $e;
exit;
}
?>
'HTML' 카테고리의 다른 글
★ php substr ★ Zend-Technologies Zend 200-530 (0) | 2011.05.09 |
---|---|
★ php substr ★ [PHP] javascript escape 대응 함수 (0) | 2011.05.09 |
★ APM php apache ★ 하늘을 날고픈 프로그래머 - [APM설치] MySQL5.0 + Apache2 + PHP5 설치 (0) | 2011.05.09 |
★ php substr ★ Break Limits - preg_match() (0) | 2011.05.09 |
★ php substr ★ 썬글쓰 - php 간단요약 (0) | 2011.05.09 |