HTML <form> with enctype Attribute
You are Here:
HTML <form> with enctype Attribute
The enctype
attribute specifies how to encode a form-data before sending it to a server.
application/x-www-form-urlencoded
Used to send characters with encoding, when a form is submitted.
This is the default behavior.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<form action="/form-urlencoded.php" enctype="application/x-www-form-urlencoded">
Name: <input type="text" name="myname">
<button type="submit">Submit</button>
</form>
</body>
</html>
Attribute Value
Value | Explanation |
---|---|
application/x-www-form-urlencoded | Used to send characters with encoding, when a form is submitted. This is the default behavior. |
multipart/form-data | Used to send images, files, etc., when a form is submitted. |
text/plain | Used to send characters without encoding, when a form is submitted. |
multipart/form-data
Used to send images, files, etc., when a form is submitted.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<form action="/multipart.php" method="post" enctype="multipart/form-data">
<input type="file" name="userFile">
<button type="submit">Submit</button>
</form>
</body>
</html>
text/plain
Used to send characters without encoding, when a form is submitted.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<form action="/text-plain.php" enctype="text/plain">
Name: <input type="text" name="myname">
<button type="submit">Submit</button>
</form>
</body>
</html>
Reminder
Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in HTML.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.