Link with Wininet.lib
DWORD __stdcall Upload(void *)
{
printf("Start upload...\n");
HINTERNET intern = InternetOpen("YaRR", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0);
if(!intern)
{
printf("Unable to open an internet - %d\n", GetLastError());
return 0;
}
HINTERNET intern2 = InternetConnect(intern, "ftp.host.com", 21, "username", "password", INTERNET_SERVICE_FTP, 0, 0);
if(!intern2)
{
printf("Unable to open a connection - %d\n", GetLastError());
InternetCloseHandle(intern);
return 0;
}
if(FtpPutFile(intern2, "myfile.html", "myfile.html", FTP_TRANSFER_TYPE_BINARY, 0))
{
printf("Upload complete\n");
}
else
{
printf("Upload failed - %d\n", GetLastError());
}
InternetCloseHandle(intern);
return 0;
}
CreateThread(0, 0, Upload, 0, 0, 0); //start