home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / expandpath.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.4 KB  |  53 lines

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