php 파일 확장자 구하기
페이지 정보
작성자 관리자 작성일 23-01-11 11:58 조회 2,929 댓글 0본문
$file_temp_name = $_FILES['upload_file']['name'];
//확장자
$file_temp_ext = strtolower(substr(strrchr($file_temp_name, '.'), 1));
// 허용할 파일확장자
$allowed_ext = array('jpg', 'jpeg', 'png', 'gif');
// 확장자 확인
if( !in_array($file_temp_ext, $allowed_ext) ) {
echo "<script> alert('ERROR'); location.href='./'; </script>";
exit;
}
댓글목록 0
등록된 댓글이 없습니다.