FileExists

Description

Returns YES if the file specified in the argument exists; otherwise, returns NO.

Category

System functions

Syntax

FileExists(absolute_path) 

See also

DirectoryExists, ExpandPath, GetTemplatePath

Parameters

Parameter
Description
absolute_path
A absolute path

Example

<!--- This example shows the use of FileExists --->
<html>
<head>
<title>
FileExists Example
</title>
</head>

<body bgcolor = silver>
<H3>FileExists Example</H3>

<cfset thisPath = ExpandPath("*.*")>
<cfset thisDirectory = GetDirectoryFromPath(thisPath)>
<cfoutput>
The current directory is: #GetDirectoryFromPath(thisPath)#
<cfif IsDefined("FORM.yourFile")>
<cfif FORM.yourFile is not "">
<cfset yourFile = FORM.yourFile>
  <cfif FileExists(ExpandPath(yourfile))>
  <P>Your file exists in this directory. You entered
  the correct file name, #GetFileFromPath("#thisPath#/#yourfile#")#
  <cfelse>
...