html - Qu'est-ce qu'enctype=έ#39;multipart/form-dataΖ#39 mean

Mots clés : htmlhttp-headersmultipartform-datahtml

meilleur 1 Réponses html - Qu'est-ce qu'enctype=έ#39;multipart/form-dataΖ#39 mean

vote vote

100

<!DOCTYPE html> <html lang="en"> <head>   <meta charset="utf-8"/>   <title>upload</title> </head> <body> <form action="http://localhost:8000" method="post" enctype="multipart/form-data">   <p><input type="text" name="text1" value="text default">   <p><input type="text" name="text2" value="a&#x03C9;b">   <p><input type="file" name="file1">   <p><input type="file" name="file2">   <p><input type="file" name="file3">   <p><button type="submit">Submit</button> </form> </body> </html> 
echo 'Content of a.txt.' > a.txt  echo '<!DOCTYPE html><title>Content of a.html.</title>' > a.html  # Binary file containing 4 bytes: 'a', 1, 2 and 'b'. printf 'a\xCF\x89b' > binary 
while true; do printf '' | nc -l localhost 8000; done 
POST / HTTP/1.1 [[ Less interesting headers ... ]] Content-Type: multipart/form-data; boundary=---------------------------735323031399963166993862150 Content-Length: 834  -----------------------------735323031399963166993862150 Content-Disposition: form-data; name="text1"  text default -----------------------------735323031399963166993862150 Content-Disposition: form-data; name="text2"  aωb -----------------------------735323031399963166993862150 Content-Disposition: form-data; name="file1"; filename="a.txt" Content-Type: text/plain  Content of a.txt.  -----------------------------735323031399963166993862150 Content-Disposition: form-data; name="file2"; filename="a.html" Content-Type: text/html  <!DOCTYPE html><title>Content of a.html.</title>  -----------------------------735323031399963166993862150 Content-Disposition: form-data; name="file3"; filename="binary" Content-Type: application/octet-stream  aωb -----------------------------735323031399963166993862150-- 
61 CF 89 62 
boundary=---------------------------735323031399963166993862150 
-----------------------------735323031399963166993862150 
POST / HTTP/1.1 [[ Less interesting headers ... ]] Content-Type: application/x-www-form-urlencoded Content-Length: 51  text1=text+default&text2=a%CF%89b&file1=a.txt&file2=a.html&file3=binary 

Questions similaires