views:

132

answers:

1

I have an application in VC++ 6 (not MFC) , feature requires it to upload a file to a web server on regular basis. Web server is under our control, anonymous upload scripts/page are already setup that would accept a file manually.

How to program in VC++ 6 to upload? which classes to use? I understand it is much possible with smtp and ftp but how through http?

A: 

On Windows 2000 upwards, you could use InternetWriteFile API

Open session using InternetOpen

Open URL using InternetOpenUrl

and create buffers to read file from the filesystem and use InternetWriteFile to send it to the server opened by InternetOpenUrl

To use HTTP specifically, you could use WinHttpWriteData API

support functions needed for this is similar to the above, and it's well defined on MSDN

Indeera