Solved

How to test for existence of file?

Posted on 2004-04-19
3
189 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 83
IPA - can it be run on a web server? 3 250
Problem to go to page 12 115
app server have enough resources... 2 67
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
What You Need to Know when Searching for a Webhost Provider
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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