<?
require_once "./config/dbclass.php";
require_once "./config/function.php";
require_once "./config/LoginRequired.php";
$db=new mydb();
$sql = "select * from document_list where idx_no ='$_GET[idx_no]' ";
$data=$db->ql($sql);
$file_path="./files/$data[i_name]";
header("Content-Type: application/octet-stream");
Header("Content-Disposition: attachment;; filename=$data[i_name]");
header("Content-Transfer-Encoding: binary");
Header("Content-Length: ".(string)(filesize($file_path)));
Header("Cache-Control: cache, must-revalidate"); header("Pragma: no-cache");
header("Expires: 0");
$fp = fopen($file_path,'r+b') ;
if (!fpassthru($fp)) {
fclose($fp);
}else {
echo("<script language='JavaScript'>alert('\\n\\n해당 파일이나 경로가 존재하지 않습니다.\\n');</script>");
exit();
}
?>