Im trying to set up a web server that receives and handles a couple of http requests. Unfortunately, I’m stuck on “POST multipart” requests.
I use a html form to send the data to my server. It looks like this:
<form method="POST" action="process_upload.php" enctype="multipart/form-data">
<input type="file" name="user_upload">
<input type="hidden" name="duration">
<input type="hidden" name="test" value="test test">
<button type="submit">Send</button>
</form>
When the form is sent, server receives:
POST /process_upload.php HTTP/1.1
Host: localhost:27015
Connection: keep-alive
Content-Length: 129985
Cache-Control: max-age=0
Origin: http://localhost:27015
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary1JhkT5GiE89P2SBs
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36
Sec-Fetch-User: ?1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Referer: http://localhost:27015/index
Accept-Encoding: gzip, deflate, br
Accept-Language: sv-SE,sv;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: PHPSESSID=5motqqf425llf53j5hutj0a0bn
------WebKitFormBoundarymRYGcz75Ct8BV6bh
Content-Disposition: form-data; name="user_upload"; filename="myfile.jpg"
Content-Type: image/jpeg
ÿØÿáɧ¦¨ä"Ö]2üà©–=/D‰…Ë7]^ÞXªë§¬–-zƉx›Ž;?•?üƒî«û³o±Vôì°%²úŸà£õ'õ·òùÿmá±E~ßÝ°Ú׫Ç{NÉò·ƒLûúÌHøûs–ŸsÅ“µï²gÃi½î¢©ÇR»ŽE¼S^]þÏÿ
**//End of message here.**
As you can see, information about two input fields is missing (duration and test). Full content length is received and no supplementary request is sent.
What is happening and what should I do?
Best Regards
Neo