libURLDownloadToFile | |||||||||||||
Type | command | ||||||||||||
Dictionary | LCS | ||||||||||||
Library | LiveCode Script | ||||||||||||
Syntax |
| ||||||||||||
Associations | internet library | ||||||||||||
Summary | Downloads a file from an Internet server asynchronously via FTP, HTTP or HTTPS | ||||||||||||
Introduced | 2.0 | ||||||||||||
OS | mac, windows, linux, ios, android, web | ||||||||||||
Platforms | desktop, server, mobile | ||||||||||||
Parameters |
| ||||||||||||
Example |
| ||||||||||||
Related | Property: fileType, script Message: urlProgress, startup, openBackground, preOpenStack, openStack, preOpenCard Library: Internet library, library Keyword: URL, ftp, file Glossary: LiveCode custom library, application, standalone application, message, property, file, Standalone Application Settings, command, main stack, OS X, type signature, group, creator signature, binary, server, download, parameter, Mac OS, handler, object Function: URLStatus, files Command: libURLSetStatusCallback, libURLFollowHttpRedirects, unload, put, load, libURLSetFTPStopTime, libURLftpUploadFile | ||||||||||||
Security | network | ||||||||||||
Description | Use the libURLDownloadToFile command to download a file from an FTP Server or Web Server. The libURLDownloadToFile command transfers the data directly from the file to the server. Unlike simply using the put command to put the contents of a URL into a file, using the libURLDownloadToFile command does not load all the data into memory at once, so this command is a better choice for large files. The libURLDownloadToFile command transfers the file in binary mode. The callbackMessage is sent to the object whose script contains the libURLDownloadToFile command, after the download is complete, so you can handle the callbackMessage to perform any tasks you want to delay until the file has been downloaded. Two parameters are sent with the message : the URL and the URLStatus of the file.
*Cross-platform note:* On iOS and Android, libURLDownloadToFile is implemented in the engine. Therefore the Internet library is not needed to ensure the command works in a mobile standalone application. If included, the Internet library implementation will be used instead of the engine implementation. *Cross-platform note:* On iOS and Android libURLDownloadToFile is blocking until the download is complete. Completion of the download is notified by the urlProgress message, where you can test if the downloaded status is set. | ||||||||||||
Tags | networking |