Enctype= ' Multipart/form-data '
HTML forms provide three methods of encoding.
upload a file in the form <form> to add attributes enctype= "Multipart/form-data", many people just rote know upload form to write so, know it but do not know why.
So why do you add this property? What does it mean? What other optional values does it have?
In fact, the form form, when you do not write the Enctype property, also adds the Enctype property value to it by default, which is enctype= "application/x-www-form-urlencoded". This property manages the MIME encoding of the form, with a total of three values to choose from:
which
①application/x-www-form-urlencoded is the default value, you may have seen this in Ajax: Xmlhttp.setrequestheader ("Content-type", "application/ X-www-form-urlencoded "); The two things to do is to set the encoding of the form transfer. It is possible to make an error in Ajax without writing, but the HTML form table dropdowns can not write enctype= "application/x-www-form-urlencoded" because the default HTML forms are the type of transmission encoding.
②multipart-form-data is used to specify the special type of transmission data, mainly the non-textual content we upload, compared to tablets or MP3 and so on.
③Text/plain is the meaning of plain text transmission, in the sending of the message to set this type of encoding, or receive when the coding confusion , the network often take text/plain and text/html do compare, actually these two very good distinction, The former is used to transfer plain text files, while the latter is the encoding type for passing HTML code, which is used only when sending header files. ① and ③ cannot be used to upload files, only multipart/form-data can pass the file data intact.
Excerpt from: http://www.cnblogs.com/mumue/archive/2012/05/24/2515984.html
=======================end=======================
Form form enctype= ' Multipart/form-data '