The formenctype
attribute on an <input> button specifies how the form data will be encoded before sending it to the server.
This attribute can only be used on input types submit
and image
.
A formenctype
attribute on a submit button.
The second button will submit the form data as plain text.
<form action="/tutorial/action.html" enctype="multipart/form-data">
<input type="text" name="email" placeholder="Enter email">
<input type="submit" value="Submit as encoded text"/>
<input type="submit" formenctype="text/plain" value="Submit as plain text" />
</form>
The formenctype
attribute overrides the form's enctype attribute.
This attribute specifies how the form data will be encoded before sending it to the server.
This attribute can only be used on input types submit
and image
.
<input type="submit | image" formenctype="application/x-www-form-urlencoded | multipart/form-data | text/plain">
Value | Description |
---|---|
application/x-www-form-urlencoded |
All form data characters will be encoded before sending to the server. This is default. |
multipart/form-data |
Form data characters are encoded before sending to the server. This value is used for forms that has upload function. |
text/plain |
Spaces are converted to "+" symbols but no characters will be encoded. |
Here is when formenctype
support started for each browser:
Chrome
|
1.0 | Dec 2008 |
Firefox
|
1.0 | Nov 2004 |
IE/Edge
|
10.0 | Sep 2012 |
Opera
|
10.6 | Oct 2010 |
Safari
|
5.1 | Oct 2011 |