The Enctype property of the form is encoded and is commonly used in two ways: application/x-www-form-urlencoded and Multipart/form-data, and the default is application/ X-www-form-urlencoded.
When the action is get, the browser converts the form data into a string (Name1=value1&name2=value2 ...) using x-www-form-urlencoded encoding. , and then append the string to the URL and use the? Split to load the new URL.
When the action is post, the browser encapsulates the form data into the HTTP body and sends it to the server.
If you don't have a type=file control, you can use the default application/x-www-form-urlencoded.
But if you have type=file, you will need to use Multipart/form-data. The browser splits the entire form into controls and adds Content-disposition (form-data or file) to each section, Content-type (default is Text/plain), name (control name), and so on. and add a separator (boundary).
If you have the following form, and select the File1.txt upload
<form action= "Http://server.com/cgi/handle"
Enctype= "Multipart/form-data"
Method= "POST" >
<input type= "text" name= "Submit-name" value= "chmod777" ><br/>
What files are you sending? <input type= "file" name= "Files" ><br/>
</form>
It has the following body:
Content-type:multipart/form-data; boundary=aab03x
--aab03x
Content-disposition:form-data; Name= "Submit-name"
chmod777
--aab03x
Content-disposition:form-data; Name= "Files"; Filename= "File1.txt"
Content-type:text/plain
... contents of file1.txt ...
--aab03x--