Enctype of HTML <form> tags

Source: Internet
Author: User

There are three types of enctype form

application/x-www-form-urlencoded Encode all characters before sending (default)
Multipart/form-data

Character encoding is not.

You must use this value when you use a form that contains a file upload control.

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

Application/x-www-form-urlencoded is the default form send data, formatted as name=valse& name2=value2

Multipart/form-data is commonly used in picture streams

Text/plain is typically the encoding of the default program's sending data stream.

At the end of the PHP acceptance. The Text/plain method is not able to get the data using the $_post method. It is possible to $GLOBALS [' Http_raw_post_data '] , since PHP only recognizes the application/x-www.form-urlencoded standard data type by default, so the type is text/ The contents of XML cannot be parsed into an $_post array, so the prototype is retained and given to $http_raw_post_dat to receive.
$HTTP _raw_post_data only works if the Content-type type of POST is not recognized by PHP, but file_get_contents ("Php://input"), but can application/ x-www-form-urlencoded to get the corresponding stream Multipart/form-data No, that is, not multipart/form-data or application/ X-www-form-urlencoded of the time.

However, $post can obtain the corresponding key value in Multipart/form-data application/x-www-form-urlencoded, but not in Text/plain encoding.

Http://blog.sina.com.cn/s/blog_4657e98e0100dyxp.html

Http://developer.51cto.com/art/200912/168103.htm

Http://blog.sina.com.cn/s/blog_6f78e9030100rc9z.html

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.