이 글은 Velog에서 이전한 글입니다. Velog 원문 보기
게시판의 이미지 업로드 기능을 만들던 중 고화질의 이미지를 업로드 하면 오류가 생기는 문제를 발견했다. 이유를 찾아보니 파일 업로드 용량을 따로 설정하지 않아서 발생한 에러였다.
Error: FileSizeLimitExceededException
nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded;
nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field image exceeds its maximum permitted size of 1048576 bytes.
org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException
error 로그를 읽어보면 업로드할 수 있는 최대 용량을 넘긴 파일을 업로드 할 때 발생하는 에러다.
default 값이 1048576bytes로 약 1MB이다.
Solution
Spring Boot 2.X
- application.properties 파일에 아래 코드를 추가한다.
spring.servlet.multipart.maxFileSize=50MB // 용량 spring.servlet.multipart.maxRequestSize=50MB // 용량
Spring Boot 1.4.x & 1.5.x
- application.properties 파일에 아래 코드를 추가한다.
spring.http.multipart.maxFileSize=50MB spring.http.multipart.maxRequestSize=50MB - Spring Boot 1.3.x or 그 이전 버전*
- application.properties 파일에 아래 코드를 추가한다.
multipart.maxFileSize=50MB multipart.maxRequestSize=50MB
'Troubleshooting' 카테고리의 다른 글
| [시행착오] AWS 프리티어 비용 과금 이슈, 해결 방법 (0) | 2026.07.29 |
|---|---|
| 💥 아! Get 요청시에는 Message body를 사용하면 안되는구나!! (1) | 2026.07.29 |
| 💥 [Error] JWT Token 인증 문제 (0) | 2026.07.28 |
| 💥 [Error] Dirty Checking이 안되는 오류 (0) | 2026.07.24 |
| 💥 Web server failed to start. Port 8080 was already in use (0) | 2026.07.20 |