LassoScript Utility
Basics Browse Detail

[File_Serve]

Tag Link [File_Serve] Category Output
Type Process Source Available Yes
Support Preferred Version 6.0
Change Unchanged Data Source Any
Output Type None Security None
Implementation LDML Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0

Description

The [File_Serve] tag serves a file which is stored in a variable in place of the current Lasso format file. The name of the file can be specified and, in supported browsers, the file will be written to disk using that name and/or displayed in the browser.

The [File_Serve] tag can be used to serve image files, multimedia files, file archives, or even HTML files.

None of the contents of the current format file will be served. [File_Serve] completely rewrites the HTTP headers and contents of the served response. [File_Serve] also performs an [Abort] so no tags after [File_Serve] will be executed.

The first parameter to the tag should be a variable which contains the file to be served. An optional -File parameter allows the name of the file to be specified. An optional -Type parameter allows the MIME type of the served file (default 'text/html') to be overridden.

Possible MIME types include:

- text/html - HTML text
- image/jpeg - JPEG graphic file
- image/gif - GIF graphic file
- image/png - PNG graphic file
- text/xml - XML data
- application/pdf - Portable Document Format file

Syntax

[File_Serve: 'File Data']

[File_Serve: 'File Data', -File='Example.html']

[File_Serve: 'Image Data', -File='Example.gif', -Type='image/gif']

[Var: 'myFile' = (Include_Raw: 'Example.jpg')]
[File_Serve: $myFile, -File='Example.jpg', -Type='image/jpeg']

Parameters

Required Parameters
'File Data' The first parameter to the tag should be the file data that will be served.
Optional Parameters
-File The -File parameter allows the name of the file to be specified. If the browser is set to download the MIME type to disk then this file name will be used.
-Type The -Type parameter specifies the MIME type of the served file. Defaults to text/html.
-Disposition The disposition can be set to 'Inline' to force most browsers to display the served file in the browser rather than saving it to disk.
-Charset Specifies the character set for the served data.

Examples

See the Lasso 8 Language Guide for examples of how to use this tag.