- 0133技术站
- 联系QQ:88526
- QQ交流群
- 微信公众号
当 method 属性值为 post 时, enctype 是将form的内容提交给服务器的 MIME 类型 。可能的取值有:
application/x-www-form-urlencoded:未指定属性时的默认值。
multipart/form-data:这个值用于一个 type 属性设置为 "file" 的 <input> 元素。
text/plain (HTML5):将空格转换为 "+" 符号,但不编码特殊字符。
这个值可以被 <button> 或者 <input> 元素中的 formenctype 属性重载(覆盖)。
所有主流浏览器都支持 enctype 属性。
无
<form enctype="value">
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <form action="demo-post_enctype.php" method="post" enctype="multipart/form-data"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type="submit" value="提交"> </form> </body> </html>
点击 "运行实例" 按钮查看在线实例
推荐手册