Enctype Properties for HTML <form> tags

Source: Internet
Author: User

In HTML, the form label is used to submit the form. The form label has a enctype property.

The enctype property specifies how the form data should be encoded before it is sent to the server that is, in the syntax of the form element, enctype indicates the format of the submitted data.


value of the Enctype property
Serial Number value Description
1 application/x-www-form-urlencoded

(1) Encode all characters (default) before sending. The form data is encoded as a "name/value" pair, which is the standard encoding format.


(2) When the action is get, the browser uses x-www-form-urlencoded encoding to convert the form data into a string (Name1=value1&name2=value2 ... ), and then append the string to the URL, using the. Split, to load the new URL.


(3) When the action is post, the browser encapsulates the form data into the HTTP body and then sends it to the server.


2 Multipart/form-data

(1) do not encode characters. The form data is encoded as a message, and each control on the page corresponds to a part of the message. You must use this value when you use a form that contains a file upload control.


(2) If there is no type=file control, the default application/x-www-form-urlencoded is available. But if you have type=file, you will need to use Multipart/form-data. The browser splits the entire form into units of controls and adds Content-disposition (form-data or file) to each section, Content-type (default = Text/plain), name (control name), and so on. and add the separator (boundary).

3 Text/plain Spaces are converted to "+" plus signs, but special characters are not encoded.




Enctype Properties for HTML <form> tags

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.