되는 HTML의 형태는자바 서블릿에서 HttpServletRequest의 파일을받는 방법
...
<form method="post" action="/foobar">
<input type="file" name="attachment" />
<input type="text" name="foo" />
... other input fields
</form>
처럼 그리고 서블릿
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String attachment = request.getParameter("attachement");
String foo = request.getParameter("foo");
// get other parameters from the request
// and get the attachment file
}
처럼 될 것입니다 그리고 난
- 을 궁금하네요
HttpServletRequest
개체에서 타사 라이브러리를 사용하여 파일을 가져 오는 방법이 있습니까? 무엇을
request.getParameter("attachement")
이 반환합니까? 파일 이름인가요?바이너리 입력을 파일 시스템의 웹 컨테이너 또는 메모리에 임시로 자동 저장합니까?
여기있다 : http://stackoverflow.com/questions/2422468/how-to-upload-files-to-server-using-jsp -servlet/2424824 # 2424824 –
http://stackoverflow.com/questions/3831680/httpservletrequest-get-post-data JSON 데이터를 처리 할 수도 있습니다. 첨부 파일이 URL로 표시되는 경우 HTTPURLConnection을 사용하여 데이터를 가져와야합니다. –