The formenctype Attribute

The Current State of HTML5 Forms

<form enctype="multipart/form-data">
  <input type=submit value=Submit ↵
     formenctype="application/x-www-form-urlencoded">
</form>

Live Demo


 


Firefox
4+

Safari
5.2+

Safari
5+

Chrome
10

Opera
10.6+

IE
10+

Android
4.0

The Low Down

The formenctype attribute can force a form to submit the data in the specified encoding rather than the encoding specified in the form element when submitted as “post”.

  • Valid as an attribute of elements that can submit a form, including <inputtype=submit> and <input type=image> and <button>.
  • Possible values include
    • the default of “application/x-www-form-urlencoded” which encodes special chars in the URL to ASCII HEX values and spaces to ‘+’,
    • no encoding with multipart/form-data, and
    • text/plain which only converts spaces to +, and leaves other characters as is.
  • Setting a value other than typical encoding types yields inconsistent results.

Our Cookie Policy and Privacy Policy outline how we use cookies to help personalize content, tailor and measure our marketing, and improve your user experience. I agree to use of cookies for these purposes.