fileOpen
Opens a file
fileOpen(filePath [, mode [, charset] [, seekable]]) → returns any
Argument Reference
filePath string Required
An absolute path of an on-disk or in-memory file on the server
mode string
Default: read
read
Type of access you require to the file stream
Values:
readreadBinarywriteappend
charset string
Character encoding identified by the file's byte order mark, if any; otherwise, JVM default file character set
Values:
utf-8iso-8859-1windows-1252us-asciishift_jisiso-2022-jpeuc-jpeuc-krbig5euc-cnutf-16
seekable boolean
Default: false
false
Whether the file is usable with the
fileSeek function Examples Sample code invoking the fileOpen function
// Open File
var fileObject = fileOpen("/path/to/file.txt");
// Perform Actions
try
{
// Read Line
writeOutput(fileReadLine(fileObject));
}
// Error Handling
catch(any ex)
{
// Report Exception
writeDump(ex);
}
// Always Close
finally
{
// Close File
fileClose(fileObject);
}
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/fileopen