Home  >  Article  >  Web Front-end  >  form What is the use of using enctype field when uploading files_HTML/Xhtml_Web page production

form What is the use of using enctype field when uploading files_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:37:281545browse

The enctype attribute of the FORM element specifies the encoding type used when submitting form data to the server. The default value is "application/x-www-form-urlencoded".

This encoding method will urlencode the content before sending the form. (Spaces are converted to " ", and special characters are converted to ASCII HEX values).

For example, if we fill in bb in the form field

firstname,

the result we get before sending is: bb,,

However, This encoding is inefficient when sending large amounts of text, text containing non-ASCII characters, or binary data to the server.

When uploading files, the encoding type used should be "multipart/form-data", which can send text data and also supports binary data upload.

The ENCTYPE attribute value of the

form on the browser side is multipart/form-data, which tells us that the data to be transmitted must use the multimedia transmission protocol. Since multimedia transmits a large amount of data, uploading is required The file must be a post method, and the type attribute of must be file.
Statement:
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