<?php
include("./mysql_intro.php");
include("./script_alert.php");
$j_wr = $_POST['j_wr'];
$j_tt = $_POST['j_tt'];
$j_cn = $_POST['j_cn'];
$path = "c:\\uploads\\";
$j_ps = "";
$file_name = "";
if(!empty($_POST['j_ps'])){
$j_ps = $_POST['j_ps'];
}if(!empty($_FILES['j_fl']['name']){
$file_name = $_FILES['j_fl']['name'];
$file_name = preg_replace("/\.(php|exe|inc|jsp|asp|htaccess)/i","",$file_name);
if($_FILES['j_fl']['error'] > 0){
echo "file transmission fales";
}else{
if(is_uploaded_file($_FILES['j_fl']['tmp_name'])){
echo "file transmission success";
move_uploaded_file($_FILES['j_fl']['tmp_name'], $path.$filename);
echo "uploaded file : ".$path.$_FILES['j_fl']['name'];
}
}
}
?>
<?php
$filename = $row['uploads'];
$path = "C:\uploads\".$filename;
if(!eregi($_SERVER['HTTP_HOST'], $_SERVER['HTTP_REFERER'])) Error("외부에선 다운로드 하실수 없습니다.");
if(is_file($path)){
if(eregi("(MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)){
Header("Content-Type:application/octet-stream");
Header("Content-Length:".filesize($path));
Header("Content-Disposition:attachment; filename=".$filename);
Header("Content-Transfer-Encoding:binary");
Header("Pragma:no-cache");
Header("Expires:0");
}else{
Header("Content-Type:file/unknown");
Header("Content-Length:".filesize($path));
Header("Content-Disposition:attachment; filename=".$filename);
Header("Content-Description:PHP3 Generated Data");
Header("Pragma:no-cache");
Header("Expires:0");
}$fp = fopen($path, "rb");
if(!fpassthru($fp)) fclose($fp);
clearstatcache();
}else{
echo "해당 파일이나 경로가 존재하지 않습니다";
}
'Server Enterprise > PHP' 카테고리의 다른 글
간단한 mysql 쿼리와 php와의 상관관계 (0) | 2012.07.20 |
---|---|
UTF8 및 한글 블록 현상 해결 방안 (0) | 2012.07.20 |
Server DB 연결 (0) | 2012.07.20 |