Discussion:
Put a file on a web server
(too old to reply)
dududuil
2006-04-27 12:06:02 UTC
Permalink
Hi all,
I have an ATL C++ applicaition under VS8.0
I want to 'PUT' a file on a web server using winHttp.

I can read the file myself, copy it to a buffer and sent it with
'WinHttpWriteData' call.
But can I send the file itself without reading it myself?
thanks
Dudu
Phil Wilson
2006-04-27 20:02:35 UTC
Permalink
You could look at BITS to do an upload to an IIS virtual directory. There's
a C++ Platform SDK sample at ..\Microsoft Platform
SDK\Samples\Web\bits\Upload.
--
Phil Wilson [MVP Windows Installer]
----
Post by dududuil
Hi all,
I have an ATL C++ applicaition under VS8.0
I want to 'PUT' a file on a web server using winHttp.
I can read the file myself, copy it to a buffer and sent it with
'WinHttpWriteData' call.
But can I send the file itself without reading it myself?
thanks
Dudu
dududuil
2006-04-28 06:54:02 UTC
Permalink
I must use WinHttp.
So if it doesn't support file transfers, I will have to implement it myself,
and wish to avoid that.
That WinHttp support files transfers???

Thansk
Dudu
Post by Phil Wilson
You could look at BITS to do an upload to an IIS virtual directory. There's
a C++ Platform SDK sample at ..\Microsoft Platform
SDK\Samples\Web\bits\Upload.
--
Phil Wilson [MVP Windows Installer]
----
Post by dududuil
Hi all,
I have an ATL C++ applicaition under VS8.0
I want to 'PUT' a file on a web server using winHttp.
I can read the file myself, copy it to a buffer and sent it with
'WinHttpWriteData' call.
But can I send the file itself without reading it myself?
thanks
Dudu
Stephen Sulzer
2006-04-28 09:24:45 UTC
Permalink
No, WinHttp does not support directly uploading a file. The application must
read the file contents into one or more buffers for WinHttpSendRequest
and/or WinHttpWriteData. For a very large file, it is not necessary to load
the entire file into a single buffer; the application can read a chunk of
the file at a time and send it using WinHttpWriteData.

If uploading a file without your application buffering it is critical for
you, then you will need to use Winsock directly: creating and sending the
HTTP request headers yourself and then uploading the file using Winsock's
TransmitFile API. If you do not need to worry about HTTP authentication, SSL
or web proxies, then uploading the file this way should not be very
difficult.

Regards,
Stephen
Post by dududuil
I must use WinHttp.
So if it doesn't support file transfers, I will have to implement it myself,
and wish to avoid that.
That WinHttp support files transfers???
Thansk
Dudu
Continue reading on narkive:
Loading...