The enctype attribute of form is encoded in two ways: Application/X-WWW-form-urlencoded and multipart/form-data, the default value is application/X-WWW-form-urlencoded.
When the action is get, the browser uses the X-WWW-form-urlencoded encoding method to convert form data into a string (name1 = value1 & name2 = value2 ...), then append the string to the end of the URL, using? Load the new URL.
When the action is post, the browser encapsulates form data into the HTTP body and sends it to the server.
If there is no type = file control, use the default application/X-WWW-form-urlencoded.
However, if type = file exists, you need to use multipart/form-data. The browser splits the entire form into controls and adds content-disposition (Form-data or file) and Content-Type (text/plain by default) to each part ), name (Control name) and other information, plus the delimiter (Boundary ).
If you select file1.txt for 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>
The following body is available:
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 --