Whatever message this page gives is out now! Go check it out!

GetPropertyFile

Last update:
May 18, 2026

Description

Retrieves all the key-value pairs in the specified properties file.

Returns

Struct of the key-value pairs in the properties file.

Syntax

getPropertyFile(String filePath, String encoding)

History

  • ColdFusion (2025 release): Added the function

Parameters

Parameter
Required
Type
Description
filePath
Yes
String
The absolute path of the properties file.
encoding
No
String
The encoding of the properties file. The default is UTF-8. If not specified, picks the default encoding.

Example

Example 1
<cfscript>
    path =GetDirectoryFromPath(GetCurrentTemplatePath()) & "config.properties"
    properties=getPropertyFile(path);
    writeDump(properties)
</cfscript>
Example 2- invalid encoding
<cfscript>
    //incorrect enconding format
    try {
        path = GetDirectoryFromPath(GetCurrentTemplatePath()) & "config.properties";
        property1 = getPropertyFile(path,"ISO-8859-1121");
        writeDump(property1)
    } 
    catch (any e) {
    writeOutput(e.message);
    }
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page