Open In App

HTML | <input> formenctype Attribute

Last Updated : 12 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML <input> formenctype Attribute is used to specify how to form-data encoded when submitting the form into the server. This attribute works with method=”post”. This attribute overrides the enctype attribute of the <form> element. 

Syntax:

<input formenctype="value">

Attribute Values:

  • application/x-www-form-urlencoded: It is the default value. It encodes all the characters before sent to the server. It converts all spaces into “+” symbols and special character into its “hex” value.
  • multipart/form-data: This value does not encode any character.
  • text/plain: This value convert spaces into “+” symbols but special characters are not converted.

Example: 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>HTML input formenctype Attribute</title>
</head>
 
<body style="text-align: center">
 
    <h1 style="color: green">GeeksforGeeks</h1>
 
    <h4>HTML &lt;input&gt; formenctype Attribute</h4>
 
    <form action="#" method="post">
 
        First name:
        <input type="text" name="fname"> Last name:
        <input type="text" name="lname">
        <br>
        <br>
 
        <input type="submit" value="Submit"
               formenctype="multipart/form-data">
    </form>
</body>
 
</html>


Output:

  

Supported Browsers: The browsers supported by HTML input formenctype Attribute are listed below:

  • Google Chrome 9.0 and above
  • Edge 12.0 and above
  • Internet Explorer 10.0 and above
  • Firefox 4.0 and above
  • Opera 12.1 and above
  • Safari 5.0 and above

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads