ÿØÿà JFIF ` ` ÿþ
Server : Apache System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : tkt_travelbus ( 1137) PHP Version : 7.0.0p1 Disable Function : mysql_pconnect Directory : /tkt_travelbus/www/admin/setting/ |
Upload File : |
<? include "../include/top_proc.html"; //공통파일 인클루드 include "_common.php"; header("Content-type: text/html; charset=utf-8" ); $upload = $_SERVER['DOCUMENT_ROOT']."/FileData/lang_data/"; // 파일 업로드 경로 $table = "TB_TRANSLATE"; if($_FILES["datafile"]["size"]>0) { $filename = $_FILES["datafile"]["name"]; $pathinfo=pathinfo($filename); if($pathinfo[extension] !='csv') { echo "<script> alert('파일 형식이 일치 하지 않습니다.'); history.back(); </script>"; exit(); } copy($_FILES["datafile"]["tmp_name"],$upload.$filename); }else { echo "<script> alert('파일을 등록해 주세요.'); history.back(); </script>"; exit(); } $fcontents = file($upload.$filename); $num = 0; while (list ($line_num, $line) = each ($fcontents)) { $str_arr = explode("|",$line); $str_arr_count = count($str_arr); $num++; //$ko = iconv('euc-kr','utf-8',$str_arr[0]); $ko = $str_arr[0]; $en = $str_arr[1]; //$cn = iconv('euc-kr','utf-8',$str_arr[2]); $cn = $str_arr[2]; //$hk = iconv('euc-kr','utf-8',$str_arr[3]); $hk = $str_arr[3]; $count = db_fetch("select count(*) as cnt from $table where ko='{$ko}' "); if($count['cnt'] < 1) { $query = "insert into TB_TRANSLATE (ko,en,cn,hk)values ('$ko','$en','$cn','$hk')"; $result = db_query($query); } } @unlink($_FILES["datafile"]["tmp_name"]); if($result){ echo "<script> alert('정상적으로 데이터가 등록 되었습니다.'); location.href='site_translate.html'; </script>"; }else{ echo "<script> alert('실패하였습니다.'); location.href='site_translate.html'; </script>"; } ?>