I'm getting really frustrated with this.. I've been working on this
for over 16 hours and have yet to get a binary file uploaded to a
HTTP server.. I've done some notation below.
"Ben Voigt [C++ MVP]" <rbv@nospam.nospam> wrote in message
news:u%23pKzaobIHA.4344@TK2MSFTNGP02.phx.gbl...
Chizl wrote:
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:OYYI4ymbIHA.5988@TK2MSFTNGP06.phx.gbl...
Chizl <Chizl@NoShitMail.com> wrote:
CComBSTR bstrHeader;
bstrHeader.Append("Content-Length: ");
bstrHeader.Append(pSize);
bstrHeader.Append("Cache-Control: no-cache\r\n");
bstrHeader.Append("Content-Type: multipart/form-data;
boundary=Xu02=$; Charset=UTF-8\r\n");
No, not BSTR. That's what Igor has been telling you. BSTR is
UNICODE, HTTP uses single byte characters.
Use std::string or CStringA instead.
When I try using an STL String I get errors.. WinHttpAddRequestHeaders()
second param requires a const unsigned
short *. Best that I know is to T2OLE(char*), but that's basically
doing the same thing I'm already doing.
I've updated the file...
http://www.chizl.com/aspuploaded/WinHTTP.cpp
I'm receiving no errors, everything seems to do what it supposed to do
through IIS, however the server never saves the file.. Based on the
code, I've added a totalbytes sent and it shows all data was sent.. I'm
not seeing where the problem is..
there is no Unicode in HTTP, there's 8-bit headers and binary payload.
But I checked and WinHttp seems to be Unicode-only. Try WinInet instead
HttpAddRequestHeadersA, etc).