internet transfer control INET PASSIVE TRANSFER
Hello people,
I hope someone can help a newcomer with a problem.
Im using the Inet control with the icFTP-protocol to transfer a single file to an FTP-server. Works perfect with the following code:
But my problem is i need to use passive transfers.. so i tried
But it wont work.. how can i define this as a passive transfer?
Im really thankfull for answers with sollutions or ideas.
Re: internet transfer control INET PASSIVE TRANSFER
i don't believe you can do this with inet, but you can using ftp APIs
Re: internet transfer control INET PASSIVE TRANSFER
can you please give me some easy APIs with PASV
Re: internet transfer control INET PASSIVE TRANSFER
attach module from http://www.vbforums.com/showpost.php...09&postcount=8 to your project, then use code as below, the INTERNET_FLAG_PASSIVE is the constant to use passive connection
vb Code:
Dim session As Long, server As Long, ftpserver As String, user As String, pass As String
Dim ret As Long, localfile As String, remotefile As String
ftpserver = ' your ftp server
user = 'login name
pass = 'password
localfile = App.Path & "\" & fname
remotefile = fname
session = InternetOpen(App.EXEName, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE)
server = InternetConnect(session, ftpserver, INTERNET_INVALID_PORT_NUMBER, user, pass, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)
ret = FtpPutFile(server, localfile, remotefile, FTP_TRANSFER_TYPE_BINARY, 0)
if ret = 0 then msgbox "upload failed"
InternetCloseHandle server
InternetCloseHandle session
see the complete thread above for some troubleshooting and other information, there is also api to change directory on the remote server