在下面的例子中,表單數據會在未編碼的狀況下進行發送: 服務器
<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 |