fileupload

    파일 업로드 구현하기

    학습 목표 Spring MVC를 이용해 파일 업로드를 하기 위한 설정을 할 수 있다. Spring MVC에서 파일 업로드를 위한 Controller를 작성할 수 있다. 핵심 개념 commons-fileupload MultipartResolver MultipartFile maven pom.xml에 파일 업로드와 관련된 라이브러리를 추가해야 합니다. commons-fileupload commons-fileupload 1.2.1 commons-io commons-io 1.4 DispathcerServlet에게 멀티파트 요청이 올경우 파일 업로드 처리가 될 수 있도록 MultipartResolver객체를 등록합니다. 최대 10메가 크기의 파일이 저장되도록 설정 @Bean public MultipartResolv..

    file upload방법의 이해

    form data를 통해 file upload를 할 수 있다. type : input tag에 들어갈 type 선언 name : server에서 인식 할 수 있게 name 선언 id : client에서 제어를 위해 id 선언 accept : 허용 가능한 file type 제한 일반적인 form 데이터 전송 시에 HTTP Header에는 기본적으로 Content-Type:application/x-www-form-urlencoded 라는 정보로 노출 됩니다. 그러나 file을 전송할 때는 좀 다릅니다. Form 태그의 속성으로, enctype를 multipart/form-data로 지정해야 합니다. Content-Type: multipart/form-data; boundary=----WebKitFormBou..