<동일 form에서 파일 여러개 받을 때 html>

<th>첨부파일</th>
<tr><td colspan="3" class="text-align-left text-indent"><input type="file" name="file" /></td></tr>
<th>첨부파일</th>
<tr><td colspan="3" class="text-align-left text-indent"><input type="file" name="file" /></td></tr>
(그냥 중복 작성함)

 


속성 method는 url로 데이터를 보내는 방식이고 서버에서는 doGet doPost 등으로 받는다
속성 action은 메소드를 보내는 url이고 서버의 맵핑 주소
속성 name은 서버에서 map 타입 중 key이며 front, back 공통으로 parameter로 사용
속성 value는 해당 name(key)의 value 값이다 
-value는 null과 "" 빈문자열을 구분하기에 조건 처리를 둘다 해줘야 하며, html에서 전달된 내용은 문자열이기에 임시변수로 조건처리를 한 뒤 또는 할 때 형변환을 해서 사용한다

submit 버튼에도 name과 value 값을 줘서 서버로 보낼 수 있다
(submit 버튼이 두개라면 name(key) 값은 같게 해서 보내주는게 좋다)

<input type="file" name="file" />
input type을 파일로 하면 윈도우 탐색기가 열림
type을 checkbox로 하고 name과 value를 넣으면 value 값 또는 null을 반환

동일한 url과 method로 서버로 요청을 보낼때는 form으로 묶어줌
(브라우저 호환성에 따라 action 속성을 넣어주지 않으면 에러가 날 수 있다)
(기본값은 요청한 url)

+ Recent posts