File and FTP Interfaces

Sending files via FTP, FTPS (SSL/TLS)

Say you have the means of getting the path to an image file in your file system. Here is a sample script for a “To Translator” component, showing how you can use the net api to upload that file to a server via FTP/FTPS/SFTP:

-- The main function is the first function called from Iguana.
-- The Data argument will contain the message to be processed.
function main(FileId)
   local FileName = 'Images/'..FileId..'.tiff'

   local ImageFile =
   if not ImageFile then
      -- TODO make an email notification rule that sends emails
      -- whenever a log message starting with
      -- 'Image file does not exist' is found.
      print('Image file does not exist: "'..FileName..'".')

   -- set up the connection and send the file
   local Ftp = net.ftp.init{server='',username='fred',password='secret'}

In this example, I’ve just constructed the path from the ID that gets passed into the main function. This ID is produced from a “From Translator” component (see Polling a database, and generating CSV files). Note the “TODO” comment – you can set up an Iguana email notification rule to send out an email when a specific problem is encountered.

Note: FTPS/SFTP are also supported, see the api documentation for details.

For more information regarding “Details on Server SSL Certificates”, please refer to:

Leave A Comment?