Solved

How to test for existence of file?

Posted on 2004-04-19
3
184 Views
Last Modified: 2013-12-24
Before outputting a link to a file, I want to make sure that file exists. What's the best way to do that?

Using CFFILE to READ the contents into a variable and then testing for a size gt "" on the variable seems to be too much trouble just to see if it exists.

Thanks.
0
Comment
Question by:lavachickie
3 Comments
 
LVL 9

Assisted Solution

by:CFDevHead
CFDevHead earned 50 total points
ID: 10862836
FileExists(absolutePath)
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 25 total points
ID: 10863342
You can also use EpandPath in conjuction with FileExists

<cfif FileExists(ExpandPath(#variable_with_filename#))>
OUtput link
<cfelse>
don't
</cfif>
0
 

Expert Comment

by:dynabytes
ID: 10865649
FileExists(absolutePath)
0

Featured Post

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Join & Write a Comment

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now