파일 업로드
파일 업로드 라이브러리 설치
http://www.servlets.com/cos/ 에서 cos-26Dec2008.zip 을 다운받는다.
- /doc
- /lib
ㄴ cos.jar
- /src다운로드 받은후 압축을 해제하면 /lib 폴더에 cos.jar 파일이 있다.
이 파일을 현재 실행중인 프로젝트의 /WebContent/WEB-INF/lib 폴더 안에 집어넣는다.
파일 업로드하기
파일을 업로드 하면 저장이 될 폴더를 WebContent 안에 생성해준다.
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="fileFormOk.jsp" method="post" enctype="multipart/form-data">
파일 : <input type="file" name="file">
<input type="submit" value="제출">
</form>
</body>
</html>실제로 파일이 올라가는 곳은 eclipse상 경로가 아닌 서버 내부에 올라간다.
Last updated
Was this helpful?