The enctype attribute of the form tag

  • The enctype attribute specifies how to encode form data before sending it to the server. That is, the default encoding type when sending data through the form.
  • It can only be used when method = "post";
  • Attribute value:
    (1) application/x-www.form-urlencoded : the default value, all characters are encoded before sending (convert spaces to "+" signs and special characters to ASCII HEX values). Encoding data into name-value pairs is a standard encoding format.
    (2) multipart/form-data : wrong character encoding,! ! ! When using a form with a file upload control, use this value. Such as pictures or MP3. This encoding type does not encode characters, and the data is transmitted to the server in binary form. In this case, if you use request, you cannot directly obtain the value of the corresponding form. You must pass the stream object to the binary of the server. The data is decoded to read the data.
    (3) text/plain : Convert spaces to "+" symbols, but do not encode special characters. Compile in plain text, which does not contain any controls and formatting characters.

Guess you like

Origin blog.csdn.net/qq_43812504/article/details/112971213