YOUSEFUL / FILEMAKER

Youseful FTP: FAQ, examples and tutorial

Learning center · Function reference

Use YsflFtp.fmx64 for FTP/FTPS sessions, listings and binary transfers. To run the connection examples, supply your own test server and account.

FAQ

Does it support SFTP? No. SFTP uses SSH; this plug-in supports FTP and FTPS. Do not point an FTPS example at an SFTP-only server.

What is explicit versus implicit TLS? Explicit FTPS upgrades the FTP control connection with AUTH TLS; implicit FTPS starts TLS immediately. Select the mode and port your server requires. The tutorial uses explicit FTPS on port 21.

Why do later calls need a session id? Connect creates an authenticated session and returns its id. Pass that result to List, Download and other session calls. Close it with Disconnect. This implementation allows up to 16 open sessions.

Are paths local or remote? List's path is on the server. Download has a remote source and local destination; Upload has a local source and remote destination. Relative remote paths use the session's current directory.

Examples

Connect using values supplied by your script:

filemaker
Set Variable [ $session ; Value: YsflFt_Connect ( $server ; $user ; $password ; "tls=explicit timeout=15" ) ]

Result: a session id or an error. Check it before making another session call.

After a successful connection, list names in the login directory:

filemaker
YsflFt_List ( $session ; "" ; "names" )

Result: the server's names, one per line. An empty directory can return empty text. The complete tutorial below checks errors and closes the session.

Tutorial

Standalone sample scripts: Browse FTPS.

Goal: browse a test FTPS account without uploading, deleting or changing files.

  1. Obtain your test hostname, account name and password. Replace the three placeholders; the example hostname is not a live service.
  2. Create a script named Youseful - Browse FTPS:
filemaker
Set Variable [ $server ; Value: "ftp.example.com:21" ]
Set Variable [ $user ; Value: "YOUR_TEST_USER" ]
Set Variable [ $password ; Value: "YOUR_TEST_PASSWORD" ]
Set Variable [ $session ; Value: YsflFt_Connect ( $server ; $user ; $password ; "tls=explicit timeout=15" ) ]
Set Variable [ $connectError ; Value: YsflFt_LastError ]
If [ $connectError <> 0 ]
    Show Custom Dialog [ "FTPS connection failed" ; YsflFt_LastErrorText ]
    Exit Script [ Text Result: $session ]
End If
Set Variable [ $names ; Value: YsflFt_List ( $session ; "" ; "names" ) ]
Set Variable [ $listError ; Value: YsflFt_LastError ]
Set Variable [ $listMessage ; Value: YsflFt_LastErrorText ]
Set Variable [ $closed ; Value: YsflFt_Disconnect ( $session ) ]
Set Variable [ $password ; Value: "" ]
If [ $listError <> 0 ]
    Show Custom Dialog [ "Listing failed" ; $listMessage ]
Else
    Show Custom Dialog [ "Remote files" ; If ( IsEmpty ( $names ) ; "Directory is empty" ; $names ) ]
End If
If [ Left ( $closed ; 1 ) = "?" ]
    Show Custom Dialog [ "Disconnect failed" ; $closed ]
End If
  1. Run it. Expect the account's directory listing, or a specific connection/listing error. The session is disconnected even when the listing fails.

For production code, obtain credentials through your application's intended credential flow instead of embedding them in a script.

Troubleshooting

If login works but listing fails, check passive data-port access and server FTPS requirements. Confirm that your certificate trust and TLS mode match the server. Capture the listing error before Disconnect clears it.