메뉴 건너뛰기

프로그램언어

조회 수 20181 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

up_process.php 파일 --------------------------------------------------------------
  $UpFile = $HTTP_POST_FILES["ImageFile"][name];
  if($UpFile) // 업로드할 화일이 있는지 확인
  {
    $FileName = GetUniqFileName($UpFile, $SavePath); // 같은 화일 이름이 있는지 검사
    move_uploaded_file($HTTP_POST_FILES["ImageFile"][tmp_name],"$SavePath$FileName"); // 화일을 업로드 위치에 저장
  }
------------------------------------------------------------------------------------


*GetUniqFileName 함수 --------------------------------------------------------------
function GetUniqFileName($FN, $PN)
{
  $FileExt = substr(strrchr($FN, "."), 1); // 확장자 추출
  $FileName = substr($FN, 0, strlen($FN) - strlen($FileExt) - 1); // 화일명 추출

  $ret = "$FileName.$FileExt";
  while(file_exists($PN.$ret)) // 화일명이 중복되지 않을때 까지 반복
  {
    $FileCnt++;
    $ret = $FileName."_".$FileCnt.".".$FileExt; // 화일명뒤에 (_1 ~ n)의 값을 붙여서....
  }

  return($ret); // 중복되지 않는 화일명 리턴
}
------------------------------------------------------------------------------------


하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved