ph_readfile PowerHome formula function
Description
Reads the contents of a file into memory and returns it as either a string or hex encoded string
Syntax
ph_readfile ( as_filename )
ph_readfile ( as_filename, ai_type )
Argument | Description |
as_filename | String. The full path and filename of the file you wish to read |
ai_type | Integer (Optional). Parameter controlling how
the file data is returned. Use 0 to return as a normal string. Any other
value will read the file contents and encode them as a hex encoded string.
If this parameter is omitted, the default value of 0 will be assumed |
Return value
String. Returns the contents of the file as a string or hex encoded string
Usage
Use this function to read the contents of a
file and return the data as a string. For textual based files, you'll usually
want to use an ai_type of 0. If the file contains binary data such as a graphic
file, set the ai_type parameter to 1 so the data will be returned as a hex
encoded string
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_readfile("C:\powerhome\web\logtemp\last.csv")
• ph_readfile("c:\powerhome\web\ph.gif",1)