<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>EXPANDPATH</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">EXPANDPATH</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Creates an absolute, platform-appropriate path that is equivalent to the value of relative_path, appended to the base path. This function (despite its name) can accept an absolute or relative path in the relative_path parameter
</p>

<p>
The base path is the currently executing page's directory path. It is stored in pageContext.getServletContext().
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span>
<p>
A string. If the relative path contains a trailing forward slash or backward slash, the return value contains the same trailing character.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
System functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>ExpandPath(relative_path)
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
FileExists, GetCurrentTemplatePath, GetFileFromPath
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">History</span>
<p>
ColdFusion&#160;MX: Changed behavior for the relative_path parameter: this function can now accept an absolute or relative path in the relative_path parameter. To resolve a path, this function uses virtual mappings that are defined in the ColdFusion Administrator. This function does not reliably use virtual mappings that are defined in IIS, Apache, or other web servers. 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
If the parameter or the returned path is invalid, the function throws an error.
</p>

<p>
These examples show the valid constructions of relative_path:
</p>
<ul>

<li>ExpandPath( &quot;*.*&quot;)</li>

<li>ExpandPath( &quot;/&quot;)</li>

<li>ExpandPath( &quot;\&quot;)</li>

<li>ExpandPath( &quot;/mycfpage.cfm&quot;)</li>

<li>ExpandPath( &quot;mycfpage.cfm&quot;)</li>

<li>ExpandPath( &quot;myDir/mycfpage.cfm&quot;)</li>

<li>ExpandPath( &quot;/myDir/mycfpage.cfm&quot;)</li>

<li>ExpandPath( &quot;../../mycfpage.cfm&quot;)</li>
</ul>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;h3&gt;ExpandPath Example - View Only&lt;/h3&gt;
&lt;!---
&lt;cfset thisPath=ExpandPath(&quot;*.*&quot;)&gt;
&lt;cfset thisDirectory=GetDirectoryFromPath(thisPath)&gt;
&lt;cfoutput&gt;
The current directory is: #GetDirectoryFromPath(thisPath)#

&lt;cfif IsDefined(&quot;form.yourFile&quot;)&gt;
&lt;cfif form.yourFile is not &quot;&quot;&gt;
&lt;cfset yourFile = form.yourFile&gt;
   &lt;cfif FileExists(ExpandPath(yourfile))&gt;
   &lt;p&gt;Your file exists in this directory. You entered
   the correct file name, #GetFileFromPath(&quot;#thisPath#/#yourfile#&quot;)#
   &lt;CFELSE&gt;
   &lt;p&gt;Your file was not found in this directory:
   &lt;br&gt;Here is a list of the other files in this directory:
   &lt;!--- use CFDIRECTORY to give the contents of the
   snippets directory, order by name and size ---&gt;
   &lt;CFDIRECTORY DIRECTORY=&quot;#thisDirectory#&quot;
   NAME=&quot;myDirectory&quot;
   SORT=&quot;name ASC, size DESC&quot;&gt;
   &lt;!--- Output the contents of the CFDIRECTORY as a CFTABLE ---&gt;   
   &lt;CFTABLE QUERY=&quot;myDirectory&quot;&gt;
   &lt;CFCOL HEADER=&quot;NAME:&quot;
         TEXT=&quot;#Name#&quot;&gt;
   &lt;CFCOL HEADER=&quot;SIZE:&quot;
         TEXT=&quot;#Size#&quot;&gt;
   &lt;/CFTABLE&gt;
   &lt;/cfif&gt;
&lt;/cfif&gt;
&lt;cfelse&gt;
&lt;h3&gt;Please enter a file name&lt;/h3&gt;
&lt;/CFIF&gt;
&lt;/cfoutput&gt;

&lt;FORM action=&quot;expandpath.cfm&quot; METHOD=&quot;post&quot;&gt;
&lt;h3&gt;Enter the name of a file in this directory &lt;I&gt;
&lt;FONT SIZE=&quot;-1&quot;&gt;(try expandpath.cfm)&lt;/FONT&gt;&lt;/I&gt;&lt;/h3&gt;
&lt;INPUT TYPE=&quot;Text&quot; NAME=&quot;yourFile&quot;&gt;
&lt;INPUT TYPE=&quot;Submit&quot; NAME=&quot;&quot;&gt;
&lt;/form&gt;
 ---&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="RELATIVE_PATH">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">RELATIVE_PATH</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>Relative or absolute directory reference or file name, within the current directory, (.\&#160;and&#160;..\) to convert to an absolute path. Can include forward or backward slashes.</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
