Skip to content
Advertisement

HTTP POST query how to calculate content length

I am making a HTTP POST query to a server and I am creating the post body manually. I think I am making some mistake with the content-length header because on the server side when I get the http response at the beginning I see the headers with http response 200 and then when in my php script I print the post parameters and file names I get the correct values but together with some junk bytes. Here is the body of my http post:

JavaScript

Here is the output from the server(ignore [0.0] – it comes from the console where I print the result)

JavaScript

And the php script on the server which is as simple as you can think of:

JavaScript

Advertisement

Answer

JavaScript

…I would say is the way it should be done

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement