Verifies whether an image file is valid.

isImageFile(value) → returns boolean

Argument Reference

value string

Pathname to an image file.

Sample code invoking the isImageFile function

If the local file path is for an image, write the image to the browser

<cfset myImage = expandPath("./sample.png")>
<cfif isImageFile(myImage)>
	<cfimage action="writeToBrowser" source="#myImage#">

Output whether the online file is an image


Expected Result: true

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub