ActiveX: SLFTP (Filename: SLFTP.OCX)
![]()
| SLFTP is an ActiveX control that can be used to communicate with an FTP server. You can with this control for example download or upload files, create or remove directories, list directories, get information about files (for example the file size) etc. |
Properties
| Name | Type | Description |
| IsConnected | Boolean | Indicates if there is a
connection with the FTP server. If there is a connection, this property
returns True. If there is no connection, this property returns False. |
| Password | String | Specifies the password to use
when connecting to the FTP server. |
| RemotePort | Long | Specifies the port number to use
when connecting to the FTP server. The default value for this property is
21. |
| RemoteServer | String | Specifies the FTP server name. |
| Username | String | Specifies the user name to use
when connecting to the FTP server. |
Methods
| Before you use any of the FTP commands in the SLFTP
control you must call the OpenConnection
or OpenSyncConnection method to open a connection
to the FTP server. When you don't need to communicate with the FTP server
anymore you must call CloseConnection
to close the connection. If an error occurs using any of the methods in this
control you can call the GetLastError method to
obtain the error code. Some errors can also be obtained as a text message by
calling the GetErrorMessage
method. |
|
OpenConnection () As Boolean Opens a connection to an FTP server. The RemoteServer, RemotePort, Password and Username properties must have proper values set before this method is called. The method returns True if successful, or False otherwise. OpenSyncConnection
(sAgent As String, AccessType As Long, sProxyName As String) As Boolean CloseConnection
() As
Boolean |
CreateDir (sDir As String) As Boolean Creates a directory, specifies by sDir, on the FTP server. Returns True if successful, or False otherwise. DelFile
(sFilename As String) As Boolean DownloadFile
(sRemoteFilename As String, sLocalFilename
As String) As
Boolean FileExists
(sFilename As String) As Boolean GetCurDir () As
String GetErrorMessage
() As String GetFileDateTime
(sFilename As String) As
String GetFileSize
(sFilename As String) As
Long GetLastError
() As Long ListDir
(sDir As String, sFileSpec
As String) As
String RemoveDir
(sDir As String) As Boolean SetCurDir
(sDir As String) As Boolean StoreFile
(sLocalFilename As String, sRemoteFilename As
String) As Boolean |
Example
Dim bStatus As Boolean
SLFTP1.RemoteServer = "ftp.test.com"
' Specify the FTP
server
SLFTP1.Username = "SamLogic"
' Specify the username
SLFTP1.Password = "test"
' Specify the password
If SLFTP1.OpenConnection() Then
' Open a connection
with the FTP Server
If SLFTP1.SetCurDir("/www") Then
' Set current directory
to "/www"
If SLFTP1.FileExists("index.htm") Then
' Check that the file
exists
bStatus = SLFTP1.DownloadFile("index.htm",
"c:\temp\index.htm") '
Download file
End If
End If
SLFTP1.CloseConnection
End If
![]()