Lasso Soft Inc. > Home

[File_Write]

[File_Write] writes data to the specified file. Accepts two paramaters, the name of the file to be written and the data which should be written into the file. Optional -FileOverWrite keyword specifies that the destination file should be overwritten if it exists, otherwise the data specified is appended to the end of the file.

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.

  • Syntax
  • Parameters
[File_Write: File NameFile Data]

[File_Write: File NameFile Data, -FileOverWrite]
Required Parameters
File Name The name of the file to be written.
File Data The data which should be appended to the file.
Optional Parameters
-FileOverwrite If specified then the file data is written to the start of the file (overwriting any existing data) rather than appended to the end of the file.
Examples

To write data to a file:

Use the [File_Write] tag. The following example writes the contents of a variable theFileContents into a file named myfile.txt from the root of the Web serving folder.

<?LassoScript
    File_Write: '/myfile.txt', $theFIleContents, -FileOverWrite;
    Output: (File_CurrentError: -ErrorCode) + ': ' + (File_CurrentError);
?>
Result:
0: No Error
Tag Link [File_Write] Category File
Type Process Data Source Any
Support Preferred Version 3.0
Output Type None Security Tag,File
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0,LDML3x

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