Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top