Sunday November 19, 2017

       
      SteelArrow Basics
      SteelArrow Tags
  SteelArrow Functions
  SteelArrow Objects
  Advanced Topics
  WAS Overview
   
   
       
      Overview
  Code Samples
  Site Search
   
   
   


Get SteelArrow!     
  <SAWRITEFILE>    
 
 
Secure Tag
Return to Tag List
 
The WRITEFILE tag offers the ability to output textual data to a file. The tag does not support absolute or '..' (parent) directory access. With this tag, files can only be created or added to in the script directory. For security reasons, this is by design.

As well, the tag supports a CREATEDIR action that allows for the creation of a directory under the current template directory. UPLOAD is also supported for HTML file uploads, and the action SIZE is supported to report the size of a file or directory (directories are a recursive size).

Note: WRITEFILE supports "virtual" paths. These paths can be configured by the system administrator.

 
Attributes:
FILEfile or directory (relative to current directory or a virtual directory)
NAMEvariable to receive success code (TRUE or FALSE)
ACTIONCREATE, APPEND (default), CREATEDIR and UPLOAD
FILEDATArepresents HTML FORM field name; used with ACTION="UPLOAD"
LOCKLock file during write? YES or NO (NO by default)

 
The following is an example of WRITEFILE;
 
<SAREADFILE FILE="SomeFile.dat" NAME=entry LOCK="YES">
<SASET NAME=entry VALUE=Replace( entry, "is", "IS" )>

<!--- Write out a new data file --->
<SAWRITEFILE FILE="GuestBook.htm" ACTION="CREATE">
   #entry#
</SAWRITEFILE>


<!--- Read file and create a list with lines --->
<SAREADFILE FILE="SomeDir\SomeFile.dat" NAME=entry>
<SASET NAME=entry VALUE=MakeList( Char(10), entry )>

<!--- Write out (append) the data with line #'s --->
<SAWRITEFILE FILE="SomeDir\SomeFile.dat">
   <SALOOP FROM=0 TO=entry.Length() NAME=count>
      Line:#count+1# #entry#</SALOOP>
</SAWRITEFILE>

<!--- Read file (using virtual path) --->
<SAREADFILE FILE="\common\Data\SomeFile.dat" NAME=entry2>

<!--- Write file (using virtual path) --->
<SAWRITEFILE FILE="\otherDir\SomeDir\SomeFile.dat">
   #entry2#
</SAWRITEFILE>






Copyright © 1998-2004 Tomahawk Technologies Inc.
Privacy Policy