Carpe Programming/java
[파일 존재 여부 체크] URLConnection
nolite
2013. 2. 20. 12:57
import java.net.URLConnection;
URLConnection conn = null;
url = new URL(http://www.aaaa.co.kr/img/wow.jpg);
conn = url.openConnection();
if(conn.getContentType().equals("image/jpg") && conn.getContentLength() > 0) {
//이미지 타입의 해당 파일이 존재 할 경우 처리
}else{
//파일이 존재하지 않을 경우 처리
}
728x90