Home > Backend Development > PHP Tutorial > A brief analysis of the difference between application/x-www-form-urlencoded and multipart/form-data_PHP tutorial

A brief analysis of the difference between application/x-www-form-urlencoded and multipart/form-data_PHP tutorial

WBOY
Release: 2016-07-13 10:24:08
Original
916 people have browsed it

In the syntax of the Form element, EncType indicates the format of submitted data

Use the Enctype attribute to specify the encoding type used by the browser when sending data back to the server.

Here are the instructions:

application/x-www-form-urlencoded: Form data is encoded as name/value pairs. This is a standard encoding format.

multipart/form-data: Form data is encoded as a message, and each control on the page corresponds to a part of the message.

text/plain: Form data is encoded as plain text without any controls or formatting characters.

Supplement

The enctype attribute of form is the encoding method. There are two commonly used ones: application/x-www-form-urlencoded and multipart/form-data. The default is application/x-www-form-urlencoded.

When the action is get, the browser uses the x-www-form-urlencoded encoding method to convert the form data into a string (name1=value1&name2=value2...), and then appends the string to the end of the url. Split with ? to load this new url.

When the action is post, the browser encapsulates the form data into the http body and then sends it to the server.

If there is no type=file control, just use the default application/x-www-form-urlencoded.

But if there is type=file, multipart/form-data will be used. The browser will divide the entire form into control units, and add information such as Content-Disposition (form-data or file), Content-Type (default is text/plain), name (control name), and Add delimiter (boundary).

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825538.htmlTechArticleIn the syntax of the Form element, EncType indicates the format of submitted data. Use the Enctype attribute to specify when sending data back to the server. The encoding type used by the browser. Here are the instructions: application...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template