Fuego.Net : FTPServer

The FTPServer component is used to interact with an FTP server. The FTPServer component can:


Example 1

In this example, the FTPServer component is used to connect to an FTP server and upload a file:

do
  // Connect
  server = "example_ftp_server"
  username = "example_user"
  password = "example_password"

  connectTo FTPServer 
      using host = server, 
          user = username, 
          password = password
   
  // Change directory
  FTPServer.currentDirectory = "mydir" 
   
  // Upload file
  storeFileIn FTPServer 
      using localfile = "/tmp/test.txt", 
          remotefile = "test.txt", 
          mode = "I" 
on exit 
  disconnectFrom FTPServer 
end

Example 2

In this example, the FTPServer component is used to access the files in the current directory on the FTP server :

for each file in FTPServer.files 
do 
  // process each file (String) 
  // Your code goes here... 
end