Sample code for 30+ languages & platforms
Lianja

Use Explicit FTP over TLS

See more FTP Examples

Demonstrates how to connect to an FTP server using explicit FTP over TLS.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loFtp = createobject("CkFtp2")

loFtp.Hostname = "ftp.your-ftp-server.com"
loFtp.Username = "ftpAccountLogin"
loFtp.Password = "ftpAccountPassword"

// Indicate that the "AUTH TLS" command should be use to convert the connection to TLS
// after the initial TCP connection to port 21 is established.
loFtp.AuthTls = .T.

// Connect and convert the connection to TLS automatically.
llSuccess = loFtp.ConnectOnly()
if (llSuccess <> .T.) then
    ? loFtp.LastErrorText
    release loFtp
    return
endif

llSuccess = loFtp.LoginAfterConnectOnly()
if (llSuccess <> .T.) then
    ? loFtp.LastErrorText
    release loFtp
    return
endif

? "TLS connection established and successfully authenticated."


release loFtp