ftp | |||||||
Type | keyword | ||||||
Dictionary | LCS | ||||||
Library | LiveCode Script | ||||||
Syntax |
| ||||||
Associations | internet library | ||||||
Summary | Used as a URL type with such commands as put and get to designate a file or directory on an FTP server. | ||||||
Introduced | 1.1 | ||||||
Changes | The ability to specify a port number was added in version 2.0. In previous versions, port 21 was always used for FTP transactions. | ||||||
OS | mac, windows, linux, ios, android | ||||||
Platforms | desktop, server, mobile | ||||||
Example |
| ||||||
Values |
| ||||||
Related | Message: startup, openBackground, preOpenStack, openStack, preOpenCard Library: library, Internet library Keyword: URL, file, ftp, button, http Control Structure: function Function: result, files, libURLErrorData, value Command: libURLSetFTPListCommand, libURLSetFTPMode, get, post, put, load, group, delete URL, libURLftpUpload, libURLDownloadToFile Glossary: LiveCode custom library, flag, standalone application, upload, folder, command, main stack, blocking, text file, statement, message, cache, Standalone Application Settings, container, URL, server, keyword, application, handler, word, expression, download | ||||||
Security | network | ||||||
Description | Use the ftp keyword to upload or download files to or from an Internet site. The URL scheme "ftp" indicates information located on an FTP server. An ftp URL consists of the following parts:
If you don't specify a port number, port 21 is used. (This is the standard port for FTP.)
Here are some examples of valid ftp URLs: - ftp://ftp.example.org/directory/ -- list of files and folders in a directory - ftp://ftp.example.org/directory/file.exe -- a file on the server - ftp://user:password@ftp.example.org/myfile -- a file accessed by a password - ftp://ftp.example.com:3992/somefile -- using a nonstandard FTP port An ftp URL is a container, and you can use the expression
A URL that ends with a slash (/) designates a directory (rather than a file). An ftp URL to a directory evaluates to a listing of the directory's contents. To change the format of directory listings, use the libURLSetFTPListCommand command. FTP uploads and downloads that are performed using the ftp keyword are always transferred in binary mode: no character translation is performed. If you need to translate characters--for example, if you are uploading a text file to a different operating system and want to translate line endings--you must do so before uploading the file, since the put command will not do it for you.
The following example shows how to set a flag in a global variable to prevent multiple downloads. The variable "downloadInProgress" is set to true while a download is going on, and back to false when the download concludes. If the user clicks the button again while the download is still going on, the handler simply beeps:
To send any FTP command to an FTP server, use the libURLftpCommand function. For technical information about URLs and the ftp URL scheme, see RFC 1630.
*Cross-platform note:* On iOS and Android, you can use the ftp keyword without the need for the Internet library. When specifying URLs for iOS and Android, you must use the appropriate form that conforms to RFC 1630. | ||||||
Tags | networking |