profileUpload.jsp 코드
더보기
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../include/nav.jsp"%>
<div class="container">
<div class="d-flex justify-content-center">
<form action="/blog/user?cmd=profileUploadProc" method="post" enctype="multipart/form-data">
<div class="form-group">
<img id="img__wrap" onerror="this.src='/blog/image/userProfile.png'" src="${sessionScope.principal.userProfile}" width="350px" height="300px" />
</div>
<div class="form-group">
<input type="file" name="userProfile" id="img__preview" />
<!-- 단어를 이을 때 자바는 카멜 , html은 언더바를 주로 사용한다, 아이디쓸 때 언더바 두개 쓰기 -->
</div>
<input type="hidden" name="id" value="${sessionScope.principal.id}">
<div class="form-group">
<button class="btn btn-primary w-100">사진전송</button>
</div>
</form>
</div>
</div>
<script src="/blog/js/imgPreview.js"></script>
<%@include file="../include/footer.jsp"%>

enctype="multipart/form-data"
enc타입을 위와 같이 설정해줘야 파일을 업로드 할 수 있다.
'Web > Jsp' 카테고리의 다른 글
사진 업로드 (0) | 2020.06.11 |
---|---|
자바스크립트 on 이벤트 (0) | 2020.06.11 |
자바 UUID 생성 (0) | 2020.06.11 |
네비게이션 바에 사진 넣기 (0) | 2020.06.11 |
cos라이브러리를 이용하여 파일 업로드 및 다운로드 (0) | 2020.06.11 |