How to specify the form-data should be encoded when submitting it to the server in HTML5?
In this article, we will specify the form-data should encoding when submitting it to the server by using the enctype attribute in the <form> element in the HTML document. This property specifies the data that will be present in the form that should be encoded when submitting to the server. This property is used to save sensitive user data from a third party.
<form enctype = "value">
Note: This property can be used only if the method is “POST”.
Value: It accepts two value
- application/x-www-form-urlencoded: It has the default value. It is used to convert all the characters before sent to the server. It encodes the special characters to their hex values.
- multipart/form-data: It does not encode any plain text and special characters and only convert whitespaces into + symbols.