• 구글 계정 로그인

php 확장자 걸러보기

페이지 정보

profile_image
작성자 LJM
댓글 0건 조회 260회 작성일 17-12-05 17:12

본문

$ext = strtolower(array_pop(explode('.', $_FILES['StudentPhoto']['name'][$i])));

$denyfile = array('jpg','jpeg','JPG','JPEG');

if(in_array($ext,$denyfile)) {

echo json_encode( array(

'status' => 'error',

'message' => '첨부파일의 확장자가 '.$ext.'입니다. jpg, jpeg형식으로 올려주세요.'

));

exit;

}

 

===사용함수===

array_pop : 배열의 마지막 값 가져오기 

strtolower : 문자열을 소문자로 만듭니다

in_array : 값이 배열 안에 존재하는지 확인

댓글목록

등록된 댓글이 없습니다.