TextBuffer.fromFile Method
Replaces the content of a TextBuffer object with the content of the specified file.
Syntax
public boolean fromFile(str filename, [int encoding])
Run On
Called
Parameters
- filename
Type: str
The name of the file to read.
- encoding
Type: int
The encoding option to use; optional.
Return Value
Type: boolean
true if the file operation was successful; otherwise, false.
Remarks
The following are possible values for the encoding parameter that are supplied by the FileEncoding system enumeration:
ACP
UTF8
UTF16BE
UTF16LE
GB18030
AUTO
If the file operation is unsuccessful, the TextBuffer object remains unchanged.
If an attacker can control input to the fromFile method, a security risk exists. Therefore, this method runs under Code Access Security. Calls to this method on the server require permission from the ExecutePermission class. Make sure that the user has development privileges by setting the security key to SysDevelopment on the control that calls this method.