YouTip LogoYouTip

Att Input Formenctype

## HTML `` formenctype Attribute The `formenctype` attribute specifies how form data should be encoded when it is submitted to the server. This attribute is only applicable to forms with `method="post"`. When used, the `formenctype` attribute overrides the default `enctype` attribute of the parent `
` element. This allows you to submit the same form using different encoding types depending on which submit button the user clicks. --- ## Syntax ```html ``` ### Attribute Values | Value | Description | | :--- | :--- | | `application/x-www-form-urlencoded` | **Default.** Encodes all characters before sending. Spaces are converted to `+` symbols, and special characters are converted to ASCII HEX values. | | `multipart/form-data` | No character encoding. This value is **required** when the form contains file upload controls (``). | | `text/plain` | Converts spaces to `+` symbols, but does not encode special characters (mostly used for debugging). | --- ## Usage and Placement * **Target Elements:** The `formenctype` attribute can only be used with `` elements of `type="submit"` or `type="image"`. * **Override Behavior:** It is designed to override the `` element's `enctype` attribute on a per-button basis. * **HTML Version:** This is an **HTML5** feature. It was not supported in HTML 4.01. --- ## Code Example In the example below, the form contains two submit buttons. The first button submits the form using the default encoding, while the second button overrides the encoding to `multipart/form-data` (which is ideal if you want to dynamically handle file uploads or binary data from a specific action). ```html

``` --- ## Browser Support The `formenctype` attribute is widely supported across all modern web browsers: * **Google Chrome:** Supported * **Mozilla Firefox:** Supported * **Microsoft Edge:** Supported * **Safari:** Supported * **Opera:** Supported * *Note: Internet Explorer 9 and earlier versions do not support the `formenctype` attribute.*
← Att Input FormmethodAtt Input Formaction β†’