Lua
Lua
Use Explicit FTP over TLS
See more FTP Examples
Demonstrates how to connect to an FTP server using explicit FTP over TLS.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local ftp = chilkat.Ftp2.new()
ftp.hostname = "ftp.your-ftp-server.com"
ftp.username = "ftpAccountLogin"
ftp.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.
ftp.auth_tls = true
-- Connect and convert the connection to TLS automatically.
local success = ftp:connect_only()
if not success then
print(ftp.last_error_text)
return
end
success = ftp:login_after_connect_only()
if not success then
print(ftp.last_error_text)
return
end
print("TLS connection established and successfully authenticated.")