Hi,
has it to be WINSOCK? Here's a solution with WININET.DLL:
Declarations:
Code:
Private Const INTERNET_OPEN_TYPE_PROXY = 3
Private Const INTERNET_INVALID_PORT_NUMBER = 0
Public Const INTERNET_SERVICE_FTP = 1
Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
(ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _
ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _
(ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, _
ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Long, _
ByVal lFlags As Long, ByVal lContext As Long) As Long
Public Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _
(ByVal hFTPSession As Long, ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, _
ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Public Declare Function InternetCloseHandle Lib "wininet.dll" _
(ByVal hInet As Long) As Integer
Code to send file:
Code:
mlngSession = InternetOpen("Test Connect", INTERNET_OPEN_TYPE_PROXY, vbNullString, vbNullString, 0)
mlngConnection = InternetConnect(mlngSession, txtHost.Text, INTERNET_INVALID_PORT_NUMBER, txtUser.Text, txtPass.Text, INTERNET_SERVICE_FTP, 0, 0)
blnResult = FtpPutFile(mlngConnection, LocalFile, RemoteFile, 1, 0)
InternetCloseHandle mlngConnection
I hope this works, I just copied it out of a current project, can have some bugs :-)
Roger