Using the Internet and FTP APIs I am opening a ftp connection and logging into a site but it doesnt work when done via code so I tried manually. I get this dialog error...
What is the issue?
VB Code:
Private Sub TransmitMe() Dim hConnection As Long Dim hOpen As Long Dim sOrgPath As String Dim lRet As Long 'open an internet connection hOpen = InternetOpen("Test", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0) 'connect to the FTP server hConnection = InternetConnect(hOpen, "subdomain.example.com", INTERNET_DEFAULT_FTP_PORT, "VB-Guru", "Meow", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0) 'create a buffer to store the original directory sOrgPath = String(MAX_PATH, 0) 'get the directory FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath) 'set the current directory to 'root/Incoming FtpSetCurrentDirectory hConnection, "Incoming" 'upload the file 'test.htm' lRet = FtpPutFile(hConnection, ByVal "C:\Test.txt", "Test.txt", FTP_TRANSFER_TYPE_BINARY, 0) If lRet = 1 Then ' Else ' End If 'close the FTP connection InternetCloseHandle hConnection 'close the internet connection InternetCloseHandle hOpen End Sub





Reply With Quote