Upload file using HTTP. getting error :- HttpSendReuest 12005

a 夏天 提交于 2019-12-02 07:31:47

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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!