FileExists():

<cfif FileExists("images/#sku#.gif")>
    <img src="images/#sku#.gif">
<cfelseif FileExists("images/#sku#.jpg")>
    <img src="images/#sku#.gif">
</cfif>

Though I'd prefer Tonys method, so you don't have to do a lot of file checking.  We 
use it a lot on a app here and  haven't run into any performance problems, but a 
database solution would or course, be better.

Tim P.

----- Original Message ----- 
From: "Larry Juncker" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 9:10 AM
Subject: CFDirectory Question


> I have a shopping cart that I have created and the images can be either gif
> or jpg.
> 
> Since I am dynamically pulling from the images folder, how can I check to
> see which image exists for a particular item.
> 
> I am currently doing this:
> 
> <img src="images/#sku#.gif">
> 
> I need to be able to see if #sku#.gif exists or #sku#.jpg and then display
> the proper image.
> 
> Any help would be greatly appreciated.
> 
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to