Link to home
Start Free TrialLog in
Avatar of seahpc
seahpc

asked on

Check File Exist

Hi,

  I would like to know  how i can check the existence of a file in a local machine.

  my case, i have an input box (file)
which let user upload a file, but i am afraid user will just any how type a filename and then upload it. This will cause an error page. So I would like to check the existence of the file before I do the uploading.
ASKER CERTIFIED SOLUTION
Avatar of ruifranco
ruifranco

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Xavi053000
Xavi053000

For the existence of a file use the Fileexists(file) function. And too the path of the file with expandpath(file).

i.e: <cfset file = "/images/" & #prod.nr# & ".gif">
<cfif Fileexists(expandpath(file))>
.....
</cfif>