You are here: Reference > HTML > attributes > encType (form)

encType attribute (form)

Browser support:
Sets how form data should be encoded for submitting to the server.
You need to set this attribute value to 'multipart/form-data' if the form you want to submit to the server contains an input:file element.
JavaScript page for this attribute: encoding. You can find other example(s) there.

Possible values:

String that sets the type of encoding.
The following values must be supported by browsers:
application/x-www-form-urlencoded
If the form contains text data only, this value can be used.
multipart/form-data
If the form contains files (see input:file) or binary data, this value must be used.
Default: application/x-www-form-urlencoded.

Example HTML code 1:

This example illustrates the use of the encType attribute:
<form method="post" enctype="multipart/form-data" action="#URL#">
    Select a file: <input type="file" name="uploadFile" size="25" />
    <br /><br />
    <input type="submit" value="Upload" />
</form>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content