양식 enctype 속성
예시
양식 데이터를 서버로 보내기 전에 인코딩해야 하는 방법을 반환합니다.
var x = document.getElementById("myForm").enctype;
정의 및 사용
enctype 속성은 enctype 속성의 값을 형식으로 설정하거나 반환합니다.
enctype 속성은 양식 데이터를 서버로 보내기 전에 인코딩하는 방법을 지정합니다.
양식 데이터는 기본적으로 "application/x-www-form-urlencoded"로 인코딩됩니다. 즉, 모든 문자는 서버로 전송되기 전에 인코딩됩니다(공백은 "+" 기호로 변환되고 특수 문자는 ASCII HEX 값으로 변환됨).
브라우저 지원
Property | |||||
---|---|---|---|---|---|
enctype | Yes | Yes | Yes | Yes | Yes |
통사론
enctype 속성을 반환합니다.
formObject.enctype
enctype 속성을 설정합니다.
formObject.enctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
속성 값
Value | Description |
---|---|
application/x-www-form-urlencoded | All characters are encoded before sent (this is default) |
multipart/form-data | No characters are encoded. This value is required when you are using forms that have a file upload control |
text/plain | Spaces are converted to "+" symbols, but no special characters are encoded |
기술적 세부 사항
반환 값: | 양식 데이터를 서버로 보내기 전에 인코딩해야 하는 방법을 나타내는 문자열 |
---|
더 많은 예
예시
양식 데이터를 서버로 보내기 전에 인코딩해야 하는 방법에 대한 enctype 값을 변경합니다.
document.getElementById("myForm").enctype = "multipart/form-data";
관련 페이지
HTML 참조: HTML <form> enctype 속성
❮ 양식 개체