Avg. Rating 3.0
Tags:

Problem

You have a filename set in a variable but would like to find out what the extension is for it, perhaps to display the proper file icon next to it.

Solution

Use the listLast() function to pull this out.

Detailed explanation

<cfset myFilename='#FileNameVariable#'>
<cfset myFilename = listLast(mymyFilename,".")>

<cfoutput>
#myFilename#
</cfoutput>

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes