HTML input formenctype property
Examples
Send default encoding form data (first submit button), send coded as "multipart / form-data" form data (second submit button):
<form action="demo-post-enctype.php" method="post">
First name: <input type="text" name="fname"><br>
<input type="submit" value="提交">
<input type="submit" formenctype="multipart/form-data" value="以 Multipart/form-data 提交">
</form>
First name: <input type="text" name="fname"><br>
<input type="submit" value="提交">
<input type="submit" formenctype="multipart/form-data" value="以 Multipart/form-data 提交">
</form>
try it"
Browser Support
Internet Explorer 10, Firefox, Opera, Chrome and Safari support formenctype property.
Note: 9 and earlier versions of Internet Explorer do not support the <input> tag formenctype property.
Definition and Usage
formenctype attribute specifies how when encoding form data submitted to the server (only applies to method = "post" form).
formenctype property overrides <form> element's enctype attribute.
Note: formenctype attribute type = "submit" and type = "image" used in conjunction.
Differences between HTML 4.01 and HTML5
formenctype attribute is new in HTML5 attributes.
grammar
<input formenctype=" value ">
Property Value
值 | 描述 |
---|---|
application/x-www-form-urlencoded | 默认。在发送前对所有字符进行编码。将空格转换为 "+" 符号,特殊字符转换为 ASCII HEX 值。 |
multipart/form-data | 不对字符编码。当使用有文件上传控件的表单时,该值是必需的。 |
text/plain | 将空格转换为 "+" 符号,但不编码特殊字符。 |
HTML <input> tag