What is the use of the enctype field for form file uploading? _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
The enctype attribute of the FORM element specifies the encoding type used when the FORM data is submitted to the server. When the value of ENCTYPE is multipartform-data, it tells us that the transmitted data uses the enctype attribute of the FORM element of the multimedia transmission protocol to specify the encoding type used when the FORM data is submitted to the server, the default value is "application/x-www-form-urlencoded ".

This encoding method will urlencode the content before the form is sent. (Convert space to "+", and convert special characters to the HEX Value of ASCII ).

For example, in the form field

Set firstname to bb ,,

The final result obtained before sending is bb + % 2C % 2C.

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

During file upload, the encoding type used should be "multipart/form-data". It can send text data and upload binary data.

Browser The value of the form's ENCTYPE is multipart/form-data, which tells us that the transmitted data needs to use the multimedia transmission protocol, because the multimedia transmission is a large amount of data, therefore, the post method must be used to upload files, The type attribute of must be file.

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.