home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / fileexists.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.6 KB  |  59 lines

  1. <!--- This example shows the use of FileExists --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. FileExists Example
  6. </TITLE>
  7. </HEAD>
  8.  
  9. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  10. <BODY  bgcolor="#FFFFD5">
  11.  
  12. <H3>FileExists Example</H3>
  13.  
  14. This file has been disabled for online viewing.  Please use your
  15. copy of ColdFusion to view this example.
  16.  
  17. <!---<CFSET thisPath=ExpandPath("*.*")>
  18. <CFSET thisDirectory=GetDirectoryFromPath(thisPath)>
  19. <CFOUTPUT>
  20. The current directory is: #GetDirectoryFromPath(thisPath)#
  21.  
  22. <CFIF IsDefined("form.yourFile")>
  23. <CFIF form.yourFile is not "">
  24. <CFSET yourFile = form.yourFile>
  25.     <CFIF FileExists(ExpandPath(yourfile))>
  26.     <P>Your file exists in this directory.  You entered
  27.     the correct file name, #GetFileFromPath("#thisPath#/#yourfile#")#
  28.     <CFELSE>
  29.     <P>Your file was not found in this directory:
  30.     <BR>Here is a list of the other files in this directory:
  31.     <!--- use CFDIRECTORY to give the contents of the
  32.     snippets directory, order by name and size --->
  33.     <CFDIRECTORY DIRECTORY="#thisDirectory#"
  34.     NAME="myDirectory"
  35.     SORT="name ASC, size DESC">
  36.     <!--- Output the contents of the CFDIRECTORY as a CFTABLE --->    
  37.     <CFTABLE QUERY="myDirectory">
  38.     <CFCOL HEADER="NAME:"
  39.             TEXT="#Name#">
  40.     <CFCOL HEADER="SIZE:"
  41.             TEXT="#Size#">
  42.     </CFTABLE>
  43.     </CFIF>
  44. </CFIF>
  45. <CFELSE>
  46. <H3>Please enter a file name</H3>
  47. </CFIF>
  48. </CFOUTPUT>
  49.  
  50. <FORM action="fileexists.cfm" METHOD="post">
  51. <H3>Enter the name of a file in this directory <I><FONT SIZE="-1">(try expandpath.cfm)</FONT></I></H3>
  52.  
  53. <INPUT TYPE="Text" NAME="yourFile">
  54. <INPUT TYPE="Submit" NAME="">
  55. </FORM> --->
  56.  
  57. </BODY>
  58. </HTML>       
  59.