Whatever message this page gives is out now! Go check it out!
FileRead(filepath [, charset])
OR
FileRead(fileobj [, buffersize])Parameter | Description |
filepath | An absolute path to an on-disk or in-memory text file on the server. |
charset | The character encoding in which the file contents is encoded. The following list includes commonly used values:
|
fileobj | The file object from which to read. |
buffersize | The number of characters to read. |
<h3>FileRead Example - Reading a file</h3>
<!--- This reads and outputs the entire file contents. --->
<cfscript>
myfile = FileRead("c:\temp\myfile.txt");
WriteOutput("#myfile#");
</cfscript>
<!--- This reads and outputs the first 100 characters --->
<!--- from the same file. --->
<cfscript>
myfile = FileOpen("c:\temp\test1.txt", "read");
x = FileRead(myfile, 100);
WriteOutput("#x#");
FileClose(myfile);
</cfscript>