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

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