我试图创建一个简单的Web服务器。现在我试图让文件上传工作。
客户端代码:
<form action="http://192.168.1.5:8080/upload_Beta" method="post" enctype="multipart/form-data">
Select a file: <input type="file" name="img">
<input type="submit">
</form>
服务器得到这个:
POST /upload_Beta HTTP/1.1
Host: 192.168.1.5:8080
Connection: keep-alive
Content-Length: 6373
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://192.168.1.5:8080
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryJLmHqJmRPpyUJ6oa
Referer: http://192.168.1.5:8080/public/test/upload/upload.html
Accept-Encoding: gzip, deflate
Accept-Language: sv-SE,sv;q=0.8,en-US;q=0.6,en;q=0.4,nb;q=0.2
------WebKitFormBoundaryJLmHqJmRPpyUJ6oa
Content-Disposition: form-data; name="img"; filename="345x143px-1473cd98_TRSConnector.jpeg"
Content-Type: image/jpeg
ÿØÿà JFIF H H ÿÛ C
ÿÀ Y ÿÄ
ÿÄ B X!•Õ"#8w–µÓ13$6HRxÄ57BCSVbs’—¶ÿÚ ? ú‘mmUAU6ööÎ%umtw%Ì™-ä²ÄfI©Ç\qFIB’5ŒÈˆˆÌĪ§ŠÍKU
öŠ¿eXÖØÇn\9‘5nPóXq$¦ÝmÄךV…$ÉD¢3###!—í-®¿åÍ«ÿ ©ò¯—ƒ\îMwµ¤ÞWá—×eŒÈf5Í]•Tº»y¢u“zÆš}qµu!fŽ…òWIŸJ¹v 'üBâ׹΂ÙxV-ÆÝd}Í]tnêïÊ~´ßZÍ(ORÖ’æ£$—>fd^ñãXðóë-›Of³çdìÍéV8þ[ŽÝ›V/<ñF™&³“)K„Ä„Ai(´z)&WÚm·ZeMj±M3UaÇÒ8Rd3”d_hGm=Bi-Y©)£¤\¤.Lhˆm¨Ìͼh%>ùJn2}ÂÈy¶gi‹+ÄÇè1ØØóô-Ì”ÌˉòZ®®•ÊLjèɶ:OJd™BÝ&MÅzT B¸Â ßìB§²LÖ¹Pý
“™•½Ka7Es5)SPä´‚_ˆŽÊÍÒI8dÚPj4}QÊFâ«2€œòl}ãÖÑîoò[”˜±Mt{ëèFܬד2†hÜShuæyõ´Û-D¹
õ ñ_ak]¦]r˜òH“”bVÅ¢«¬e1# ¯eèÌIKÌ›+y§k«¼Ù}¡óZK™”+#ݶ§ÕV9e,[Tz0Éš¨Ç³™“i¯Âì¦ø[7˜µJîΆì¦Éé[T9±\iHåØ¥ÚnmÑU±"i+aQrÌŠESðm™.Uu;b^Ê8ÎÇ7ÚvÁm:ëE%.D'<bì5Ù6¥h¼Ç*ÎuúóWjžº…d4R^«†äH¯ú:âd:†\uå·Öˆ©Y¤Ý_%(ù.B€<ëÄšò‹[}ƒ+—&‹ÅÊúήŸ3•Ik@Ó*”ë–lÃe§cÜ-ô0hj5‘").¹Iæ¤È‘Ó4‰Ä~ö¡VOQ…b?J"avFCy:ÒL>Ú žWFs&ÙÃ*ÖZb¥H)ÔÔ¡µ6P–‡ú®&8‹ñ9}Î-©"L¢bFaEŒ!æbõ˵¦jÄ™í)‡2Åo¿V´œ&«˜ZPòÔO-1Çú
z¡Ä¶w/oÒTuYŒKß@B¤µ®m›Êt¸W6r’}s¢F“Óº½Ôµâ˜R[±mþ§R¶šrÁ¦òü›9×uùgMªô¤Na4¸ï¡Ä–ôe(ü;òij6z—ŸxØZ”ÊœqM©gÚ€ Iµ5V2`L°¬‰*E\ƒ—×™J×óiÆMÖ”eÍ6žu³RyC‹OðQ‘ÏÜáÇKÉÙjÚöóŸzÜxATº˜Ž¢±ö'Mœr♵ÖÌ—dÏu×]J¹hm^å©Tkjª
©··¶q+«k£¹.dÉo%–#0ÚMN:ãŠ2J”‘¨ÔfDDFf%V|Mð‰uîxƒÓóã·!‰hjNYXêû¡æ]$©Ó"[
------WebKitFormBoundaryJLmHqJmRPpyUJ6oa--
那不是base64,我做错了什么?