在下面的例子中,表单数据会在未编码的状况下进行发送: 服务器
<form action="form_action.asp"enctype="text/plain"> <p>First name: <input type="text" name="fname" /></p> <p>Last name: <input type="text" name="lname" /></p> <input type="submit" value="Submit" /> </form>
enctype 属性规定在发送到服务器以前应该如何对表单数据进行编码。 app
默认地,表单数据会编码为 "application/x-www-form-urlencoded"。就是说,在发送到服务器以前,全部字符都会进行编码(空格转换为 "+" 加号,特殊符号转换为 ASCII HEX 值)。 编码
<form enctype="value">
值 | 描述 |
---|---|
application/x-www-form-urlencoded | 在发送前编码全部字符(默认) |
multipart/form-data | 不对字符编码。 url 在使用包含文件上传控件的表单时,必须使用该值。 spa |
text/plain |