LassoScript Utility
Basics Browse Detail


Tag Link [File_Read] Category File
Type Substitution Source Available No
Support Preferred Version 3.0
Change Unchanged Data Source Any
Output Type Bytes Security Tag, File
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0, Lasso 3.x


[File_Read] reads the contents of a file. Accepts one parameter, the name of the file to be read. Two optional parameters -FileStartPos and -FileEndPos define the range of characters which should be read from the file.

The position in a file is specified starting from 0. -FileStartPos=0 will read from the first character in a file. (This is different from most indices in Lasso which identify the first character in a string as 1.)

The file tags are protected by four different permissions. The user must have permission for all of the following in order to use this tag:
- Permission to use the tag itself.
- Permission to perform the file operation.
- Permission to work in the directory which contains the files.
- The filename extensions of the files which are being worked with must be allowed in Lasso Administration.


[File_ReadFile Name]

[File_ReadFile Name,
  -FileStartPos=Start Position
  -FileEndPos=End Position]


Required Parameters
File Name The name of the file to be read.
-FileStartPos The offset in the file at which to start reading.
-FileEndPos The offset in the file at which to stop reading.


To read the contents of a file:

Use the [File_Read] tag. The following example reads the entire contents of a file named myfile.txt into a variable.

    Variable: 'theFileContents' = (File_Read: '/myfile.txt');
    Output: (File_CurrentError: -ErrorCode) + ': ' + (File_CurrentError);

0: No Error