Today, I'm very clear to know how to use FileExists and IsImage in coldfusion. Before time, I though these two tags working in the same boat but once I used these two, both are very different but slightly same.
What's the slightly same? It's very simple that we're not using the full path of file like that.
2<cfif FileExists("image.jpg")>
3 Image exists.
4<cfelse>
5 Image doesn't exist.
6</cfif>
7
8<!--- Checking file --->
9<cfif FileExists("myfile.txt")>
10 File exists.
11<cfelse>
12 File doesn't exist.
13</cfif>
If we're using the full path of image/file, FileExists doesn't work at all. At that time, we need to use IsImage for checking image exist or not.
2<cfif IsImage("http://www.ppshein.net/images/ppshein_banner.jpg")>
3 Image exists.
4<cfelse>
5 Image doesn't exist.
6</cfif>
Because, FileExists can check the directory of image/file and cannot check the full path URL of image/file. In this case, we need to use IsImage for checking image exists or valid type of image.
Sorry, I really missed out IsImageFile function of coldfusion which can support to check whether an image file is valid. Thanks, Ray for commenting about that.

Android
Top of Page
#1 by Raymond Camden on 5/29/11 - 10:53 PM
isImage is meant to check a variable to see if it is an image. It is not meant to check a file. You can use isImageFile for that.
But the point is - these functions have very specific purposes and I think you may be confusing them. Either that or I'm just not reading your entry right.
#2 by ppshein on 5/29/11 - 10:58 PM
Otherwise, I didn't notice about IsImageFile function. :)