업로드되는 파일명의 변수가 $poster 일 경우의 업로드 파일 처리..
// 업로드 파일 처리
if($poster != "none") {
// 파일명 체크
$poster_name=$HTTP_POST_FILES['poster']['name'];
// 파일타입 체크
$poster_type=$HTTP_POST_FILES['poster']['type'];
// 파일사이즈 체크
$poster_size=$HTTP_POST_FILES['poster']['size'];
// 임시 파일명 체크
$poster_tmp_name=$HTTP_POST_FILES['poster']['tmp_name'];
// 업로드 화일명 중복 체크
$chk_poster=mysql_fetch_array(mysql_query("select count(*) from $movie_table where poster='$poster_name'",$connect));
if($chk_poster[0]>0) {
echo"<script>alert("$poster_name 이란 파일명은 이미 등록되어 있습니다.");</script>
<script>history.go(-1);</script>";
exit;
}
// 업로드 화일을 디렉토리로 이동
if(!move_uploaded_file($poster, 'data/'.$id.'/'.$poster_name)){
echo"<script>alert("업로드 자료의 저장에 실패하였습니다.");</script>
<script>history.go(-1);</script>";
exit;
}
}
// 이름 중복 자료 체크
$chk_subject=mysql_fetch_array(mysql_query("select count(*) from $movie_table where subject='$subject'",$connect));
if($chk_subject[0]>0) {
echo"<script>alert("$subject 영화가 이미 등록되어 있습니다.");</script>
<script>history.go(-1);</script>";
exit;
}
// 미지정 등록번호(------)가 아닌 경우 등록번호 중복 자료 체크
if($case_num != "------") {
$chk_case_num=mysql_fetch_array(mysql_query("select count(*) from $movie_table where case_num='$case_num'",$connect));
if($chk_case_num[0]>0) {
echo"<script>alert("등록번호 $case_num 은 이미 등록되어 있습니다.");</script>
<script>history.go(-1);</script>";
exit;
}
}
|
|