$title_img = $_FILES['img_file']['name']; // 파일 이름 얻어오기
// Create target dir
$root_path = $_SERVER["DOCUMENT_ROOT"]; // . 경로 알아내기
$targetDir = $root_path . "/files/attach/images/228/". $last_num . "/"; // 지정할 경로
if (!file_exists($targetDir)) { . // 디렉토리 생성
@mkdir($targetDir);
}
$uploadFile = $targetDir . basename($_FILES['img_file']['name']); // 변수에 파일경로 및 파일 이름 저장
// move_uploaded_file( $_FILES["title"]["name"], $targetDir/$title_img);
if ( move_uploaded_file($_FILES['img_file']['tmp_name'], $uploadFile) ) { . // 지정한 경로로 파일 이동됐는지 검증
// echo "<script>console.log('ok');</script>";
} else {
// echo "<script>console.log('fail');</script>";
}