LassoScript Utility
Basics Browse Detail

[HTTP_GetFile]

Tag Link [HTTP_GetFile] Category Utility
Type Process Source Available No
Support Preferred Version 6.0
Change Unchanged Data Source Any
Output Type None, Bytes Security File Tags
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0

Description

[HTTP_GetFile] downloads a named file from a remote HTTP server and creates a local file.

The -URL parameter is required to specify the name of the remote file to fetch. The -File parameter is required to specify the name of the local file to create. An optional -Username and -Password can be specified for authentication on the remote server. File permissions are required in order to create the file locally.

If the optional -Binary parameter is specified then the tag does not create a local file. Instead it returns the bytes of the downloaded file as the return value of the tag. The -File parameter is ignored if the -Binary parameter is specified.

Syntax

[HTTP_GetFile: -URL='http://www.example.com/myfile.zip', -File='/folder/myfile.zip', -Username='Username', -Password='Password']

[HTTP_GetFile: -URL='http://www.example.com/myfile.zip', -Binary, -Username='Username', -Password='Password']

Parameters

Required Parameters
-URL The URL folder from which the file will be downloaded.
-File The path to the local file to be created.
Optional Parameters
-Username Used to specifiy a username needed to log in to the remote HTTP server.
-Password Used to specifiy a password needed to log in to the remote HTTP server.
-Binary If the -Binary keyword is specified then the return type of the tag will be bytes.

Change Notes

This tag was updated in Lasso 8 to include the -Binary parameter.

Examples

To download a file from an HTTP server:

The following example downloads a file named download.zip from the URL http://www.example.com/download.zip to the local documents folder.

[HTTP_GetFile: -URL='http://www.example.com/download.zip', -File='/documents/download.zip']

To download a file from a password-protected HTTP server on a non-default port:

The following example downloads a file named download.zip at http://www.example.com:1024/private/download.zip where a username and password are required to access to the private folder.

[HTTP_GetFile: -URL='http://www.example.com:1024/private/download.zip', -File='/documents/download.zip', -Username='my_username', -Password='my_password']