servlet-context.xml 파일에 시큐리티 필터 등록하기

    스프링 MVC는 파일을 업로드하기 위해 별도의 처리 없이 서버로 전송하는 매개변수와 파일 정보를 쉽게 전달받을 수 있는 멀티파트 기능을 지원합니다. 스프링의 멀티파트 기능을 이용하려면 다음과 같이 MultipartResolver를 servlet-context.xml 파일에 등록해야 합니다.

    <beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <beans:property name="maxUploadSize" value="100000"/> 
        <beans:property name="defaultEncoding" value="utf-8"/> 
        <beans:property name="uploadTempDir" ref="uploadDirResource"/> 
    </beans:bean>
    
    <beans:bean id="uploadDirResource" class="org.springframework.core.io.FileSystemResource">
        <beans:constructor-arg value="c:/upload/"/>
    </beans:bean>

    업로드할 수 있는 파일의 최대 크기입니다.

    기본 인코딩입니다.

    임시 저장 공간입니다.

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.