Thuộc tính kiểu mẫu HTML <input>
Ví dụ
Gửi dữ liệu biểu mẫu được mã hóa mặc định (nút gửi đầu tiên) và được mã hóa dưới dạng "multipart/form-data" (nút gửi thứ hai):
<form action="/action_page_binary.asp" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname"><br><br>
<input type="submit" value="Submit">
<input type="submit" formenctype="multipart/form-data" value="Submit as
Multipart/form-data">
</form>
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính formenctype
chỉ định cách mã hóa dữ liệu biểu mẫu khi gửi nó đến máy chủ (chỉ dành cho các biểu mẫu có method="post"
)
Thuộc tính formenctype
ghi đè thuộc tính enctype
của phần tử <form>
.
Lưu ý: Thuộc tính formenctype
được sử dụng với type="submit"
và type="image"
.
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính này.
Attribute | |||||
---|---|---|---|---|---|
formenctype | Yes | 10.0 | Yes | 5.1 | 10.6 |
Cú pháp
<input formenctype=" value ">
Giá trị thuộc tính
Value | Description |
---|---|
application/x-www-form-urlencoded | Default. All characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values) |
multipart/form-data | This value is necessary if the user will upload a file through the form |
text/plain | Sends data without any encoding at all. Not recommended |
❮ Thẻ <đầu vào> HTML