lfileload

Copy the contents of a file into a field or variable, ignoring any file redirections in the assignment file.

lfileload{/text | /raw | /image | /web}  FilePath,Target  {, UnicodeFormat | CharSet}

Example: lfileload "/textfiles/text.txt", TEXTFIELD

Qualifiers

Qualifiers
Qualifier Description
/text Translates the raw data from FilePath to the system character set or the UnicodeFormat. This is the default behavior.
/image Reads the raw data from FilePath, assuming that this data is an image. An initial hash character (#) is added to the data before copying the data to Target. (The hash character is an indicator to show that image data follows.) No further conversion is performed on the data.
/raw Reads the raw data from FilePath, except that the data in FilePath is assumed not to be an image; an initial hash character (#) is not added. No further conversion is performed on the data.
/web When used in components running in the Web Application Server, it loads files that were uploaded via the browser. The files are in raw format.

Parameters

Parameters
Parameter Data Type Description
FilePath String Name and path of the file contents to be copied; maximum 255 bytes. The file can be located in a zip archive.
Target String Name of a field, a variable, or a parameter to receive the data.
UnicodeFormat String Unicode encoding format of the input file. Valid values are: UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE and UTF-32LE. If not specified, the system character set is used.
CharSet String Character set; overrides the value of the system character set ($SYS_CHARSET). For a list of supported character sets, see $SYS_CHARSET.

Return Values

Values returned in $status
Value Meaning
>=0 The number of bytes in Target.
-1 An I/O error occurred while reading FileName.
-4 Cannot open FileName.
Values commonly returned by $procerror following fileload and lfileload
Value Error constant Meaning
-4 <UIOSERR_OPEN_FAILURE> The table or file could not be opened. The entity is not painted or the corresponding table or file does not exist in the database.
-12 <UIOSERR_FILE_READ_WRITE> An error occurred while trying to read or write to the file.
-16 through -30 <UNETERR_*> Errors during network I/O.
-1101 <UPROCERR_FIELD> An incorrect field name was provided; either the field name is not valid syntactically or the field is not available in the component.
-1113 <UPROCERR_PARAMETER> Parameter name not valid or not defined.
-1114 <UPROCERR_LOCAL_VARIABLE> Local variable name not valid or not defined.
-1115 <UPROCERR_COMPONENT_VARIABLE> Component variable name not valid or not found.
-1116 <UPROCERR_GENERAL_VARIABLE> General variable not valid.
-1117 <UPROCERR_GLOBAL_VARIABLE> Global variable name not valid or not found.

Use

Allowed in all component types.

Description

The lfileload statement copies the contents of FilePath to the specified Target, ignoring any file indirections in the assignment file.

If you want to load contents from a file located on a network, use fileload.

In other respects, lfileload works like fileload. For more information, see fileload.

Related Topics