The HTML enctype attribute specifies how form data should be encoded when submitted to the server.
Definition and Usage
➔ The enctype attribute can only be used with the <form> element.
➔ The enctype attribute only works when the value of the form action attribute is POST.
➔ If the form action attribute value is GET, the enctype attribute has no effect.
➔ The enctype attribute has the following values:
- application/x-www-form-urlencoded: (default) Used with forms with text input. All characters are encoded, spaces + symbols and special characters are converted to HEX values.
- multipart/form-data: Used for file uploads. Data is split into multiple parts for transmission. No characters are encoded.
- text/plain: Used for non-production environments. Converts spaces to + symbols, but does not convert special characters.
➔ The submit button (<input type="submit"> or <button type="submit">) can override the form's enctype using the formenctype attribute.(For example <input type="submit" formenctype="multipart/form-data" value="Submit">)