HTML form enctype Attribute
The HTML form enctype attribute’s main purpose is to indicate how the form data/values should be encoded prior to it being sent to the location defined in the action attribute on the form.
for e.g.
<form action=”scriptarticle/post_page.php” method=”post” enctype=”multipart/form-data”>
By default, form data is encoded to “application/x-www-form-urlencoded” so that spaces are converted to “+” symbols,and special characters like apostrophes, percentage and other symbols are converted to their ASCII HEX equivalent values.
The form’s enctype attribute is supported almost in all browsers.
The enctype attribute is supported only if method=”post” is used.
Other options of enctype attibute are.
- application/x-www-form-urlencoded
Default value.All characters are encoded before sent to server(spaces are converted to “+” symbol and special characters are converted to ASCII HEX values)
- multipart/form-data
No characters are encoded.
This value “multipart/form-data” should be used for submitting forms that contain files, non-ASCII data, and binary data.
- text/plain
Spaces are converted to “+” symbol but special characters are not encoded.
If you want some more information about HTML form enctype attribute follow W3 Schools link.