WinINet FtpPutFile problem
Hi, I am trying to upload a small file to server using WinINet and FtpPutFile function. The problem is that the FtpPutFile function doesn't work, something has to be wrong somewhere. Here is my code:
Code:
#include <windows.h>
#include <iostream>
#include <wininet.h>
using namespace std;
int main() {
HINTERNET hSession = InternetOpen(0, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);
HINTERNET hService = InternetConnect(hSession, "www.server.com", INTERNET_DEFAULT_FTP_PORT, "username", "password", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
FtpPutFile(hService, "filename.ext", "filename.ext", FTP_TRANSFER_TYPE_BINARY, 0);
InternetCloseHandle(hService);
InternetCloseHandle(hSession);
return 0;
}
So, where could be the problem? FtpPutFile returns false.
Thanks in advance,
Anvar.