한바다
스프링부트 오류-Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 본문
스프링부트 오류-Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
한바다진화 2024. 6. 21. 21:39☑️ 뛰어쓰기 공란,괄호 누락으로 오류 발생
☑️스프링부트에서 이미지파일 업로드
현실에서는 파일업로드가 딸깍 딸깍 버튼 몇번으로 되지만 컴퓨터 입장에서는 수많은 숫자와 문자들을 해석하는
과정의 결과로 출력되는 결과 이므로 쉽지 않은 일이라고 한다. 이미지 파일이 액박뜨거나 할때 때론 컴퓨터의
입장도 헤아려 봐야겠다
이미지를 form태그에 넣어서 업로드를 진행할 때는 enctype를 작성한다.
enctype = 어떤 파일을 전송할 때 데이터 타입이 무엇인지 체크하고
이미지 파일을 post로 업로드 하기 위해서는 mutipart/from-data를 반드시 작성해서 전달하는 것이 안전하다.
또한 en c type sms ENCoding Type이므로 entype으로 오기재 하지 않도록 주의해야 한다.
[이미지 업로드 html예시]
<h1>돼지 사진 업로드</h1>
<form action="/upload" method="post" enctype="multipart/form-data">
<div>
<label >돼지이름:</label>
<input type="text" th:field="${p.pig_name}" required>
<!--다음에 진행할 다른방법 2번 input type="text" name="pig_name" required -->
</div>
<div>
<label >돼지나이:</label>
<input type="number" th:field="${p.pig_age}" required>
</div>
<div>
<label >돼지이미지:</label>
<input type="file" th:field="${p.pig_image_path}" required>
</div>
<button>업로드</button>
</form>
'servlet' 카테고리의 다른 글
[스프링부트]dump, dumpstream. & 깃 브랜치 연결 오류 (0) | 2024.06.25 |
---|---|
스프링부트 실행시 html자원을 찾지 못하는 오류 (0) | 2024.06.24 |
[JSP]SQL Exception; error code 내부 표기로 변환할 수 없습니다 & 로그로 정보 확인 하기 (0) | 2024.06.20 |
[Mapper]스피링부트 구조 이해와 조별 깃 연결 (0) | 2024.06.19 |
Cause: java.sql.SQLException: error code [17034] 해당 위치에 지원되지 않는 SQL92 토큰 오류 포함 (0) | 2024.06.18 |