Solved

How to test for existence of file?

Posted on 2004-04-19
3
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

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…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

763 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