Form enctype property
Form Object
Definition and Usage
The enctype property can set or return the MIME type used to encode the form content.
If the form has no enctype attribute, the default value when submitting text is "application/x-www-form-urlencoded".
When the input type is "file", the value is "multipart/form-data".
Syntax
formObject.enctype=
value
The enctype property can be one of the following values:
| Value | Description |
|---|---|
| application/x-www-form-urlencoded | All characters are encoded before being sent (default) |
| multipart/form-data | No characters are encoded. This value is used for controlling form file uploads |
| text/plain | Spaces are converted to the "+" symbol, but no special characters are encoded |
Browser support





All major browsers support the enctype property
Note: Internet Explorer and Safari browsers return "application/x-www-form-urlencoded" if no enctype attribute is defined (the default), while other browsers return no value.
Example
Example
Return the encoding type used to send the form data to the server:
The output of the above example is:
text/plain
Try it »
Form Object