File lib/lib/ftp_co.lua

This is an FTP client that currently only supports file uploads. It uses coroutines so that it never blocks, and it can run in the background, while the Gtk2 GUI is fully responsive. It is based, of course, on luasocket and its FTP module. Copyright (C) 2007 Wolfgang Oertl

Functions

put (arg) Upload a file using FTP.
put_co (arg) Start a PUT request as a new thread.

Tables

request_spec Use a table with this structure to pass the request to either put or put_co.


Functions

put (arg)
Upload a file using FTP. You proably want to use the ftp_co function instead, which starts a new coroutine to asynchronously do the FTP transfer. Note: this performs login, upload and logout. Multiple commands in one session are currently not supported.

Parameters

  • arg: A table with the request specification.

Return values:

  1. rc: nil on error
  2. msg: on error, a description of the error.

See also:

put_co (arg)
Start a PUT request as a new thread. This is what you should use.

Parameters

  • arg: A table with the request specification.

See also:

Tables

request_spec
Use a table with this structure to pass the request to either put or put_co. Fields
  • source: Type of the upload; can be "file", "buffer" or a valid source object (see socket_co).
  • host: Hostname or IP address of the server
  • port: (optional) The port to connect to, default is 21.
  • callback: (optional) A function to call during the upload with status updates.

Valid XHTML 1.0!