1 Attachment(s)
[RESOLVED] FTP Logon Issue
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
Re: [RESOLVED] FTP Logon Issue
WOOT! Finally got it connecting. :D
Made a looooong distance call and it turns out that the ftp site is running on a unix box so the username needed to be lower case and the password stays as case sensitive.
Dont need the asprins anymore :D
Thanks for the help BrailleSchool.
Re: [RESOLVED] FTP Logon Issue
Using your code (after I found all the declares and constants :) ), and a valid account login, I have no problem logging in and uploading a file.
Re: [RESOLVED] FTP Logon Issue
Took me so long to get it working that you had it figured out before I posted.
Re: [RESOLVED] FTP Logon Issue
You should have posted or PM'd me. ;)
I tested it on my windows server and it worked so I knew something was up specifically with the receiving site.
I also found that they wanted the file(s) in a particular folder structure dependinng on certain conditions.
I sure hate it when proper documentation is not provided :mad:
Re: [RESOLVED] FTP Logon Issue
Quote:
Originally Posted by RobDog888
You should have posted or PM'd me. ;)
I wanted to be sure that it was or wasn't something with your code before I said anything, and finding all the APIs and declares took me a while.
Quote:
I tested it on my windows server and it worked so I knew something was up specifically with the receiving site.
That's why I always assume *nix. Windows accepts *nix logins, but not the other way around. It's also why I stay away from uppercase letters in names of files that'll be publicly accessible.
Quote:
I sure hate it when proper documentation is not provided :mad:
That's part of the fun - figuring out why a poorly documented function isn't working. You learn more that way than by reading the docs.
Re: [RESOLVED] FTP Logon Issue
Not when they say ...
[Them] "This is the correct username and password. Use exact casing. It must be your c0d."
[Robdog] "I am and I have attached a screen shot of the exact error message."
[Them "almost a week later"] Oh we are running a unix box so you need to change the username to all lower casing."
[RobDog] DOH!!!!!!!!! :mad: