상황
파일 업로드 구현 중 file.getInputStream();에 빨간줄이 떴다.
해결방법 2가지
방법1. 이클립스의 안내에 따라 try catch블록으로 감싸준다.
try {
InputStream is = file.getInputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
방법2. 메소드에 throws IOException를 붙여 예외처리를 해준다.
public String Upload(@RequestParam("file") MultipartFile file) throws IOException{
'ERROR RESOLVING' 카테고리의 다른 글
오류 Log4j - org.apache.log4j.Logger cannot be resolved to a type (0) | 2023.02.05 |
---|---|
오류 class java.lang.String cannot be cast to class (0) | 2023.01.21 |
오류 부적합한 열 유형: 1111 (0) | 2023.01.01 |
오류 Uncaught ReferenceError: jQuery is not defined (0) | 2022.12.29 |
오류 sts3 프로젝트 생성 (0) | 2022.11.23 |