When I tried to upload the binary to the web server, I noticed that setting the Content-Type header to a value with charset="utf-8" failed to ensure the integrity of the POST request data.
Chrome seems to omit all the charset attributes in both the header and body while loading the POST request together.
However, some web servers satisfy the request correctly if the charset="utf-8" attribute is enabled.
Working example:
POST /upload.php HTTP/1.1 Content-Type: multipart/form-data; boundary=----FormBoundary ------FormBoundary Content-Disposition: form-data; name="fileupload"; filename="data.bin" Content-Type: application/octet-stream ------FormBoundary-- HTTP/1.1 200 OK The file was received successfully.
Error:
POST /upload.php HTTP/1.1 Content-type: multipart/form-data; charset="utf-8"; boundary=----FormBoundary ------FormBoundary Content-Disposition: form-data; name="fileupload"; filename="data.bin" Content-Type: application/octet-stream ------FormBoundary-- HTTP/1.1 200 OK The uploaded file seems to be broken.
Adding charset="utf-8" seems like some web servers cannot decode downloaded data correctly, while this does not affect the process on other web servers.
Please note that in both cases, including the encoding after the type application/octet-stream , nothing affects, I will rather focus on adding after the type multipart/form-data .
What happens on the server and / or os when the Unicode character flag is present after a multi-page type?
source share