Work/java
java에서 파일 업로드시 파일 확장자 체크 하기
승수
2011. 12. 2. 17:45
FormFile formFile = fileList[0];
String fileName = formFile.getFileName();
에서 파일 이름을 가져 온후 split(".")로 잘라서 파일 확장자를 가져 오려고 했는데 안잘린다.
fileName.substring(fileName.lastIndexOf(".")+1,fileName.length()) < === 이렇게 하면 파일 확장자를 가져 올수 있다.
String fileName = formFile.getFileName();
에서 파일 이름을 가져 온후 split(".")로 잘라서 파일 확장자를 가져 오려고 했는데 안잘린다.
fileName.substring(fileName.lastIndexOf(".")+1,fileName.length()) < === 이렇게 하면 파일 확장자를 가져 올수 있다.