Re: Uploading Binary files to HTTPS
Chizl <Chizl@NoShitMail.com> wrote:
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:OYYI4ymbIHA.5988@TK2MSFTNGP06.phx.gbl...
Chizl <Chizl@NoShitMail.com> wrote:
Your header text is wrong. Taken from your own earlier post, the
correct header is
Content-Type: multipart/form-data; boundary=Xu02=$; Charset=UTF-8
You should call WinHttpSendRequest only once. Collect all headers in
a single string, separated by \r\n
You should call WinHttpWriteData on raw data as read from the file,
not on the contents of BSTR (where the data is already converted to
Unicode). Remove the whole BSTR-building code, you don't need it.
You are using the API directly now - just send raw bytes. No more
COM stuff.
Is this more of what your talking about? I'm getting a 500 back
from IIS, but at least I'm getting the header information and data to
send.. http://www.chizl.com/aspuploaded/WinHTTP.cpp
I'm not really an expert on WinHTTP. Consider asking in
microsoft.public.winhttp newsgroup.
BTW: how do I get the status code back from the web server using the
raw socket?
By "raw socket", do you mean WinHTTP API or literally using WinSock to
program at the socket level? With WinHTTP, you send the request, wait
for response with WinHttpReceiveResponse, then call
WinHttpQueryHeaders(WINHTTP_QUERY_STATUS_CODE |
WINHTTP_QUERY_FLAG_NUMBER)
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925