FTP functions

The FTP functions can be used for uploading or downloading files from a web server (Zorro 1.16 and above).

ftp_download(string url, string path, string username, string password)

Downloads a file from a FTP server.

ftp_upload(string url, string path, string username, string password)

Uploads a file to a FTP server.

ftp_getdate(string url, string username, string password)

Ascertains the timestamp and the file size of a file stored on a FTP server.


Stops the currently running FTP transfer.

ftp_size(): long

Returns the total file size of the current/last file in bytes.

ftp_sent(): long

Returns the amount of sent data of the current/last file in bytes.

ftp_timestamp(): long

Returns the timestamp of the current/last file, after ftp_getdate() was executed successfully.


Returns the status of a currently running or the last FTP transfer:

-1 if the last FTP transfer was stopped because of an error
0 if the FTP transfer is still running
1 if the last FTP transfer was successful

ftp_log (var mode)

Enables/disables the logging of FTP transfers. The logfile is named "ftp_log.txt".


url - URL of the file to be downloaded, or destination URL for a file upload (e.g.: "ftp://www.testhoster.com/downloads/test.txt").
path - local path + filename (e.g.: "testdir/test.txt")
username - FTP username
password - FTP password
mode - 1 to enable, 0 to disable FTP logging



function main() 
//Downloads the file "myfile.txt" and saves it in the Data folder 
  while(!ftp_status()) //as long as the download is running
  if (ftp_status() == 1) 
    printf("\nDownload successful!"); 
    printf("\nDownload failed!"); 

See also:

http functions, file functions

► latest version online