Lasso Soft Inc. > Home

[ curl->download ]

Method

Commonly used for FTP retrieval, [curl->download] retrieves a file from the remote server and places it in the specified location.

Accepts either a string specifying the destination location of the downloaded file, or the -asBytes keyword which will return the contents of the downloaded file as bytes data for serving or other additional processing as required.

* This functionality was introduced in Lasso 9.2.6

  • Syntax
curl->download('/download/filedownloaded.txt')
curl->download(-asBytes)
Examples
  • Beginner

To download a file from a remote FTP server:

Use the [curl->download] method to retrieve the file and save it in the web server's local directory.

The destination server and path name of the source file are specified in the initialization of the curl object, as well as the username and password authentication.

Code

local(c = curl(
        'ftp://server.com/path/to/file.txt',
        -username='my_username',
        -password='my_password'
    )
)
#c->download('/download/filedownloaded.txt')

Result

The file is saved to disk at /download/filedownloaded.txt

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft