Your code looks alright. How about providing us with an error number:
Code:
int main() {
HINTERNET hSession = InternetOpen(0, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);
if (!hSession) printf("InternetOpen: %d", GetLastError());
HINTERNET hService = InternetConnect(hSession, "www.server.com", INTERNET_DEFAULT_FTP_PORT, "username", "password", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if (!hService) printf("InternetConnect: %d", GetLastError());
BOOL bRet = FtpPutFile(hService, "filename.ext", "filename.ext", FTP_TRANSFER_TYPE_BINARY, 0);
if (!bRet) printf("FtpPutFile: %d", GetLastError());
InternetCloseHandle(hService);
InternetCloseHandle(hSession);
return 0;
}