- <HTML>
- <HEAD>
- <TITLE>
- FileExists Exemple
- </TITLE>
- </HEAD>
- <BODY>
- <H3>FileExists Exemple</H3>
- <CFSET thisPath=ExpandPath("*.*")>
- <CFSET thisDirectory=GetDirectoryFromPath(thisPath)>
- <CFOUTPUT>
- Le dossier courant est : #GetDirectoryFromPath(thisPath)#
-
- <CFIF IsDefined("form.yourFile")>
- <CFIF form.yourFile is not "">
- <CFSET yourFile = form.yourFile>
- <CFIF FileExists(ExpandPath(yourfile))>
- <P>Le fichier <font
- color="red">#GetFileFromPath("#thisPath#/#yourfile#")
- #</font> existe dans ce dossier.
- <CFELSE>
- <P>Le fichier #form.yourFile# n'a pas été
- trouvé.
- <BR>Voici la liste des fichiers présents dans
- le dossier courant :
- <CFDIRECTORY
- DIRECTORY="#thisDirectory#"
- NAME="myDirectory"
- SORT="name ASC, size DESC">
- <CFTABLE QUERY="myDirectory">
- <CFCOL HEADER="NAME:"
- TEXT="#Name#">
- <CFCOL HEADER="SIZE:"
- TEXT="#Size#">
- </CFTABLE>
- </CFIF>
- </CFIF>
- <CFELSE>
- </CFIF>
- </CFOUTPUT>
-
- <FORM action="fileexists.cfm" METHOD="post">
- <H3>Entrez le nom d'un fichier :<I><FONT SIZE="-
- 1"></FONT></I></H3>
-
- <INPUT TYPE="Text" NAME="yourFile">
- <INPUT TYPE="Submit" NAME="Valider" value="Valider">
- </FORM>
- </BODY>
- </HTML>
<HTML>
<HEAD>
<TITLE>
FileExists Exemple
</TITLE>
</HEAD>
<BODY>
<H3>FileExists Exemple</H3>
<CFSET thisPath=ExpandPath("*.*")>
<CFSET thisDirectory=GetDirectoryFromPath(thisPath)>
<CFOUTPUT>
Le dossier courant est : #GetDirectoryFromPath(thisPath)#
<CFIF IsDefined("form.yourFile")>
<CFIF form.yourFile is not "">
<CFSET yourFile = form.yourFile>
<CFIF FileExists(ExpandPath(yourfile))>
<P>Le fichier <font
color="red">#GetFileFromPath("#thisPath#/#yourfile#")
#</font> existe dans ce dossier.
<CFELSE>
<P>Le fichier #form.yourFile# n'a pas été
trouvé.
<BR>Voici la liste des fichiers présents dans
le dossier courant :
<CFDIRECTORY
DIRECTORY="#thisDirectory#"
NAME="myDirectory"
SORT="name ASC, size DESC">
<CFTABLE QUERY="myDirectory">
<CFCOL HEADER="NAME:"
TEXT="#Name#">
<CFCOL HEADER="SIZE:"
TEXT="#Size#">
</CFTABLE>
</CFIF>
</CFIF>
<CFELSE>
</CFIF>
</CFOUTPUT>
<FORM action="fileexists.cfm" METHOD="post">
<H3>Entrez le nom d'un fichier :<I><FONT SIZE="-
1"></FONT></I></H3>
<INPUT TYPE="Text" NAME="yourFile">
<INPUT TYPE="Submit" NAME="Valider" value="Valider">
</FORM>
</BODY>
</HTML>