업로드 파일 처리 루틴
author 관리자 date 2003-11-17 hit 155 HIT
업로드되는 파일명의 변수가 $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;
}
}
목록보기
        X  
11  PHP + JAVASCRIPT 로 해상도 체크  2003-11-17 188
10  MySQL 을 이용한 사용자 인증  2003-11-17 187
9  여러개의 난수를 중복없이 발생시키는 함수  2003-11-17 186
8  가로, 세로 비율 틀려지지 않고 크기에 맞는 썸네일 만들기  2003-11-17 159
7  단일 폼안에 다중 Submit 사용하기  2003-11-17 153
 업로드 파일 처리 루틴  2003-11-17 155
5  암호화 함수 crypt() 사용예제  2003-11-17 154
4  동일문서내의 php 배열변수를 자바스크립트에서 사용하기  2003-11-17 164
3  세션을 이용한 현재 접속자 체크 함수  2003-11-17 162
2  Timestamp 값을 날짜로 변환하기  2003-11-17 158
1  아파치 사용자인증 (User Authentication)  2003-11-17 160
1 2