The formenctype attribute is used to show how the form data should be encoded when it is submitting to the server. It introduced in HTML5 and only used with input type submit an image.
Here are the formenctype attribute values −
S.No | Value & Description |
---|---|
1 | application/x-www-form-urlencoded This is the default. All the characters are encoded before sent. |
2 | multipart/form-data None of the characters are encoded. |
3 | text/plain In this, the spaces are converted to + symbols. However, no special characters are encoded. |
Example
You can try to run the following code to learn how to use the formenctype attribute in HTML.
<!DOCTYPE html> <html> <head> <title>HTML formenctype attribute</title> </head> <body> <form action=”” method="post"> Name<input type="text" name="name"/><br> <input type="submit" formenctype="multipart/form-data" value="Submit"> </form> </body> </html>