|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
||||
|
||||
|
How do I know if a file is there?
I am trying to check to see if a specific file in a directory is there before I allow the user to move on.
I'm looking for a way to basically say, <cfif #file# exists> <img src="#file#"> <cfelse> You need to upload the file. </cfif> I looked at the CFFILE and CFDIRECTORY tags, and they don't seem to have a way to check like this. I looked into the list feature of CFDirectory, but I thought there must be a better way than to retrieve the list of files, then look through the list to see if the file name is there. Thanks for the help.
__________________
Forget Milk! Gotspy? www.gotspy.com |
|
#2
|
|||
|
|||
|
hopefully the following snippet helps you out:
<!--- Absolute path + filname to the expected file ---> <cfset myFile = "C:\bogus.txt"> <cfif FileExists(myFile)> <cfoutput>#myFile#</cfoutput> EXISTS!!! <cfelse> <cfoutput>#myFile#</cfoutput> DOES NOT EXIST!!! </cfif>
__________________
** Don't expect me to code your needs, but if I am able to help, I'm willing. Shout, grab and use the hand! ** Man can no more own the land we walk upon, as they can lay claim on the air that we breath ** DeepDown I'm addicted to structures.... ohw and music ![]() ** Almost forgot I had an account here [*o*] Last edited by DeepDown : December 17th, 2003 at 09:53 AM. |
|
#3
|
||||
|
||||
|
Wow,
Look at that! the FileExists function is right there on Page 206 of the Cold Fusion5 Language Refrence! How did I miss that!?!? Thanks! I feel pretty stupid now. I use that book almost every day, and don't remember ever seeing that function. THANKS! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > How do I know if a file is there? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|