# Metadata
Platforms: desktop, server OS: mac, windows, linux Introduced: 1.1.1 Security: network
# Syntax
libURLftpUpload value, uploadURL [, callbackMessage]
# Params
- value : The data to upload. - uploadURL : The uploadURL specifies the server and location to upload to, in the form of an FTP URL. - callbackMessage : The name of a message to send after the URL is uploaded.
# Examples
libURLftpUpload field "Data","ftp://ftp.example.org/file.txt"
libURLftpUpload URL "binfile:data.jef",myURL,"uploadDone"
libURLftpUpload myData,"ftp://me:secret@example.net/file.txt"
# Description
Use the libURLftpUpload command to put a file on a server.
The libURLftpUpload command is non-blocking, so it does not stop the current handler while the upload is completed. The handler continues while the libURLftpUpload command uploads the URL in the background. You can monitor the upload by checking the URLStatus function periodically.
To upload a file, use the file URL type (for text files) or the binfile URL type (for binary files). Because referring to a file URL contents loads the file into memory, if you are uploading a large file, make sure you have enough memory available. You can also use the libURLftpUploadFile command to upload a file.
The callbackMessage is sent to the object whose script contains the libURLftpUpload command, after the upload is complete, so you can handle the callbackMessage to perform any tasks you want to delay until the URL has been upload. Two parameters are sent with the message : the URL and the URLStatus of the file.
>*Warning:* Avoid using the wait command in a handler after executing the libURLftpUpload command. Since the libURLftpUpload command is non-blocking, it may still be running when your handler reaches the wait command. And since the libURLftpUpload command is part of the Internet library and is implemented in a handler, the wait command will stop the upload process if it is execute while the download is still going on. In particular, do not use constructions like the following, which will sit forever without upload the file:
libURLftpUpload field "Upload Data" ,myURL wait until the \ URLStatus of myURL is "uploaded" -- DON'T DO THIS
The URLStatus function returns the status of the upload file. If you no longer need to monitor the file's status, use the unload command to remove it from the URLStatus function listing.
>*Important:* The libURLftpUpload command is part of the > Internet library. To ensure that the command works in a > standalone application, you must include this > LiveCode custom library when you create your > standalone application. In the Inclusions pane of the > Standalone Application Settings window, make sure the "Internet" > script library is selected.
# Tags
# See
- **property:** script - **message:** startup, openBackground, preOpenStack, openStack, preOpenCard - **library:** Internet library, library - **keyword:** URL, ftp, file, binfile - **control structure:** function - **function:** URLStatus - **command:** libURLSetStatusCallback, unload, put, load, libURLSetFTPStopTime, libURLftpUploadFile, wait, group, libURLSetFTPMode - **glossary:** object, LiveCode custom library, non-blocking, standalone application, application, handler, function, binary file, command, execute, URL, main stack, text file, Standalone Application Settings, server, upload, message, parameter, download