I want to upload \"D:\\er.txt\" to webserver using HTTP, when I am running program, i got HttpSendRequest 12005 as an error. i used a PHP script on my webserver that will accep
According to the docs for HttpOpenRequest, the lplpszAcceptTypes
argument should change from
(const char**)"*/*\0"
to
{_T("*/*"), NULL}
You can also remove the \0
from the end of the string. You don't need to manually insert a nul terminator to a string literal.
In other words, you need to change
HINTERNET hRequest = HttpOpenRequest(hConnect, (const char*)"POST",
_T("upload.php"), NULL, NULL,
(const char**)"*/*\0", 0, 1);
to
LPCTSTR rgpszAcceptTypes[] = {_T("*/*"), NULL};
HINTERNET hRequest = HttpOpenRequest(hConnect, (const char*)"POST",
_T("upload.php"), NULL, NULL,
rgpszAcceptTypes, 0, 1);