Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to test for existence of file?

Posted on 2004-04-19
3
Medium Priority
?
193 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 200 total points
ID: 10862836
FileExists(absolutePath)
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 100 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

926 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