I have the necessity to implements a file upload on a web server in C++, I succeed with the following code:
#include #include
You shouldn't be using sprintf(buffer,"%s%s\r\n",buffer,content); on binary data. It isn't a string, so %s is wrong.
sprintf(buffer,"%s%s\r\n",buffer,content);
%s
You either need to base64 encode it with an appropriate Content-Transfer-Encoding, or use memcpy with a Content-Length header.
Content-Transfer-Encoding
Content-Length