Sets or retrieves the encoding type for the form.
Syntax
HTML <ELEMENT ENCTYPE = sType... > Scripting [ sType = ] object.enctype [ = sType ]
Possible Values
sType String that specifies or receives the format of the data being submitted by the form.
- application/x-www-form-urlencoded
- Default. Input control names and values are URL encoded. The name is separated from the value by '=' and name/value pairs are separated from each other by '&'.
multipart/form-data- Used for submitting forms that contain files, non-ASCII data, and binary data.
text/plain- Obsolete. No encoding, for browser compatibility only.
The property is read/write. The property has a default value of application/x-www-form-urlencoded.
Remarks
The ENCTYPE attribute of the form specifies how the HTTP request should be encoded. All GET requests are submitted as
application/x-www-form-urlencoded. The value ofmultipart/form-datais required (with a POST request) to submit a file to the server. The value oftext/plainforces the request to be POST.Windows Internet Explorer 8 and later. In IE8 Standards mode, the enctype Document Object Model (DOM) attribute is now supported and reflects the ENCTYPE content attribute. For more information, see Attribute Differences in Internet Explorer 8.
The enctype property was introduced in Internet Explorer 8. If backward compatibility is required, use the encoding property.
Standards Information
This property is defined in HTML 4.0.
Applies To
FORM, HTMLFormElement Constructor
See Also
encoding