SSL authentication and encryption ensures your data stays private as it travels across the public network.

Ftp ActiveX Control

The Ftp control is a powerful and flexible component-based implementation of the FTP protocol. High-level properties and methods provide quick code creation and ease-of use, while access to lower-level properties and methods provide power and control. Here are some feature highlights:

  • Select SSL 2.0, SSL 3.0, PCT, TLS or unencrypted FTP communications.
  • Login method combines connection setup and authentication into one easy step.
  • MGet and MPut methods transfer multiple files, including directory trees, with a single line of code.
  • Customize certificate acceptance and rejection; client authentication fully supported.
  • The powerful DartStream object permits the transfer of files directly to and from memory.
  • Supports both asynchronous (event-driven) and synchronous (scripted) application designs.
  • Supports large file transfers, with sizes greater than 4 GB.
  • Resumes interrupted transfers, and aborts transfers without losing the session connection.
  • Progress event reports data sent and received in real-time.
  • Listing object automatically parses listings into easy-to-use objects.
  • Performs ASCII or Binary transfers, in both Passive and Active modes.
  • Command method sends custom and raw commands to the server.
  • Creates and deletes folders on the server.
  • Get and Put methods perform complete transfer sessions from a single line of code.
  • Trace method provides access to the underlying communication, making logging and debugging sessions easy.
  • The Ftp control is NOT dependent on Wininet.dll.
  • Transfers files through all common firewalls and proxies, including Socks 4/5, Ftp SITE, Ftp USER, Ftp OPEN, Http CONNECT, and more.
  • Can be used in traditional client applications and services, as well as scalable ASP applications.
  • Can operate transparently in the background while other tasks are performed, or operate interactively like in most popular FTP applications.

Looking for the .NET version of this control?




Public Properties
Allocate Indicates whether space must be allocated on a server as part of the Store method.
Authentication Specifies the security protocol and authentication type used.
Blocked A True value indicates the control is currently executing a blocking method (Timeout is greater than 0), which has neither completed nor timed out with a ptTimeout error.
Certificate Certificate Object to use when authenticating to the remote host.
Directory Working directory on the server.
FileStructure File structure to be used for subsequent file transfers.
Listing Object containing results from the last use of the List method or the NameList method.
LocalAddress When the State property is tcpConnected, LocalAddress returns the address of the local host in dot notation (for example, nnn.nnn.nnn.nnn). When not connected, it returns an empty string.
LocalDataPort Gets or sets a string used to restrict the local data port to a value or range compatible with your firewall.
LocalPort When the State property is tcpConnected, LocalPort returns the port number that the socket is bound to. When not connected, it returns 0.
Passive Indicates how the data connection is formed.
Protocol Specifies the security protocol used.
ProxyHost Specifies the name or address of the proxy server that requests are to be routed through.
ProxyPassword Password to be sent on all requests through a proxy server that requires authentication.
ProxyPort Specifies the port used by proxy server that requests are to be routed through.
ProxyType The type of proxy server used for this connection.
ProxyUsername Username to be sent on all requests through a proxy server that requires authentication.
RemoteAddress Returns the address of the remote host in dot notation (i.e. nnn.nnn.nnn.nnn) when the State property is tcpConnected.
RemotePort Returns the port number of the remote host when the State property is tcpConnected.
Restart Indicates the server supports a restart mechanism for file downloads.
SecretKey Sets the secret key used in password encryption.
Security Sets the security level during communication.
State Provides status information to the user interface. The State event fires to signal that this property has changed.
StoreType Type of store that will be performed when the Store method is called.
System Type of operating system used by the server.
Timeout Controls the blocking behavior of methods that can be used in blocking and non-blocking ways.
TransferMode Transfer mode to be used for subsequent file transfers.
Type Data type to be used for subsequent file transfers.
Public Methods
Abort Abort any blocking method and release all system resources.
AbortCommand Gracefully abort the last command sent.
About Show the About Box.
ChangeDirectoryUp Set the working directory to the parent directory. The Directory property can be checked to discover the new working directory.
ClearCertificate Clears the Certificate object contained in the Cerificate property.
Command Send any command string to the server. This method is useful for using servers that have an extended vocabulary.
Delete Delete a file on the server.
Get Log in, get a file, and log out in one step.
Help Request helpful information from the server. The command takes an optional argument (for example, any command name) and returns more specific information as a response.
List Get a file directory listing. The server sends name and supplementary information on each file found within the specified PathName. The Listing property is populated with this information.
Login Connect to a server and send the commands to authenticate a session.
Logout Gracefully log off and terminate the connection.
MakeDirectory Create a directory.
MGet Retrieve (get) multiple files or entire directory trees.
MPut Store (put) multiple files or entire directory trees.
NameList Get a file directory listing without file attributes. The server sends a file name for each file found within the PathName specified. The Listing property is filled with filenames (only the Name property is initialized).
NoOperation Check the status of the control connection. The server should send an OK reply.
Put Login, store a file, and logout in one easy step.
RemoveDirectory Remove a directory.
Rename Rename a file.
Retrieve Retrieve (get) a complete file or part of a file starting at a specified position.
Site Specify or request site-specific services. The nature of these services and the specification of their syntax can be found in the Result parameter of the Help method.
Status Get server status information.
Store Store (send) a complete file, or part of a file starting at a specified position.
StructureMount Mount a different file system data structure without altering login or accounting information.
Trace Start or stop the accumulation of trace or debug data. Once started, this method accumulates data until it is turned off.
Public Events
Authenticate Fires when the remote host has sent a certificate to be authenticated.
Certificate Fires when the remote host is requesting a certificate and the Certificate property is not set to a valid Certificate Object.
Error Fires when an error condition occurs.
Progress Fires when the server replies to a command or while a file transfer takes place. The control interprets the reply and presents progress information with this event.
State Fires when the State property changes.

Code Example

How easy is the FTP ActiveX component to use? Check out the following VB example below, which demonstrates a simple file transfer.

Private Sub DoSecureLogin()
    ' The FTP server in this example is using Explicit SSL
    Ftp1.Authentication = atExplicitNormal ' Perform all checks in the Authenticate event.
    Ftp1.Protocol = secureAuto ' Login to the server. Security will be negotiated first.
    Ftp1.Login "server", "test", "password", , 21 ' Success! SSL connection established. Get help on the STOR
    ' command (just to test the SSL connection)
    Dim Response As String
    Ftp1.Help Response, "STOR" ' Print the response.
    Debug.Print (Response) ' Logout
End Sub

Private Sub Ftp1_Authenticate(ByVal RemoteCertificate As DartFtpCtl.ICertificate, ByVal TrustedRoot As Boolean,
                              ByVal ValidDate As Boolean, ByVal ValidSignature As Boolean, Valid As Boolean)
    Dim Msg As String
    ' Check various parts of the certificate to give the user a chance
    ' cancel if desired.
    If Not Valid Then
        If Not ValidDate And IgnoreDate = False Then Msg = Msg + "- Certificate date is invalid" + vbCrLf
        If Not TrustedRoot And IgnoreRoot = False Then Msg = Msg + "- Certificate Authority is not trusted" + vbCrLf
        If Not ValidSignature Then Msg = Msg + "- Certificate does not contain a valid signature" + vbCrLf
    End If

    If DoHostNameCheck And IgnoreHost = False Then
        If RemoteCertificate.IssuedTo <> Host Then
            Valid = False
            Msg = Msg + "- The name on the security certificate does not match the name of the site" + vbCrLf
        End If
    End If

    If Msg <> "" Then
        Msg = "The following conditions are true:" + vbCrLf + vbCrLf + Msg + vbCrLf + vbCrLf
        Msg = Msg + "Do you still wish to authenticate?"
        If MsgBox(Msg, vbYesNo + vbExclamation, "Security Alert") = vbYes Then
            DoHostNameCheck = False
            Valid = True
        End If
        Valid = True
    End If
End Sub