form enctype Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:form

Description

The enctype attribute sets how the form-data should be encoded when submitting it to the server.

The enctype attribute can be used only if method="post".

Attribute Values

Value Description
application/x-www-form-urlencoded Default. All characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values)
multipart/form-data No characters are encoded. This value is for a file upload control
text/plainSpaces are converted to "+" symbols, but no special characters are encoded

The following code shows how to Send form-data encoded as "multipart/form-data":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page_binary.asp" method="post" enctype="multipart/form-data">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit">
</form><!--   w  w w.  j  ava 2  s.c  o m-->

</body>
</html>

Related Tutorials