|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
How to use ExpandPath
Author: Mike Townend
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124417
What you can do is set them in the Application.cfm and assign them to a
variable, then at any point you have a reference to the root... Ie
Application.cfm
<CFSET sRoot = GetDirectoryFromPath(GetCurrentTemplatePath())>
Upload.cfm
<CFFILE ACTION="Upload" FILEFIELD="foo" DIRECTORY="#sRoot#">
Etc
----- Excess quoted text cut - see Original Post for more -----
Oh i see. So ExpandPath's argument is a like a relative URL. But those other
two functions are so freakin long to type!
MM
Author: Mike Mertsock
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124415
----- Excess quoted text cut - see Original Post for more -----
Oh i see. So ExpandPath's argument is a like a relative URL. But those other two
functions are so freakin long to type!
MM
Author: Angel Stewart
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124371
This helped much! Thanks!
:)
I didn't even know I needed help
but I just made a little file upload routine I was writing a lot more
efficient
than hardcoding an Application variable called imagepath.
-Gel
If you want relative to the current template you can use
GetCurrentTemplatePath()
I usually use that with GetDirectoryFromPath() wrapped around it in my
Application.cfm page for things like image upload paths
ExpandPath() is for converting the URL script name into an absolute path
HTH
Author: webguy
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124369
BTW you should add the contextroot to URLS too .
Check out Seans blog for details, www.corfield.org
If you want relative to the current template you can use
GetCurrentTemplatePath()
I usually use that with GetDirectoryFromPath() wrapped around it in my
Application.cfm page for things like image upload paths
ExpandPath() is for converting the URL script name into an absolute path
HTH
Yes, the fact that it's relative to the *base* template caused me untold
frustration before I found that out. What is the strategy behind it working
that way, instead of being relative from the current template? It does not
make for easy-to-read code.
Mike Mertsock
Alfred University Web Team
Author: Mike Townend
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124368
If you want relative to the current template you can use
GetCurrentTemplatePath()
I usually use that with GetDirectoryFromPath() wrapped around it in my
Application.cfm page for things like image upload paths
ExpandPath() is for converting the URL script name into an absolute path
HTH
Yes, the fact that it's relative to the *base* template caused me untold
frustration before I found that out. What is the strategy behind it working
that way, instead of being relative from the current template? It does not
make for easy-to-read code.
Mike Mertsock
Alfred University Web Team
Author: Mike Mertsock
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124367
Yes, the fact that it's relative to the *base* template caused me untold
frustration before I found that out. What is the strategy behind it working that
way, instead of being relative from the current template? It does not make for
easy-to-read code.
Mike Mertsock
Alfred University Web
Team
Author: Josh Trefethen
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124335
I would do it like this:
<cfif fileExists( expandPath('./Images') & trim(session.client_ID) &
trim(session.insured_ID) & '1.jpg')>
<!--- yada yada yada --->
</cfif>
HTH,
--
Josh Trefethen
.:::::[ Exciteworks, Inc ]::[ http://exciteworks.com ]:::::.
.::[ cf hosting on linux ]::[ consulting ]::[ expertise ]::.
----- Excess quoted text cut - see Original Post for more -----
Author: Pascal Peters
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124334
Expnadpath takes a relative path, so use "images/...".
Also expandpath calculates a full path from the relative path starting from the
base template (the one you requested in the URL).
Otherwise this use of Expandpath is correct.
-----Oorspronkelijk bericht-----
Van: Paige Chandler [mailto:ceaser@erols.com]
Verzonden: wo 11/06/2003 7:16
Aan: CF-Talk
CC:
Onderwerp: How to use ExpandPath
Hello All,
Is the following the correct usage of ExpandPath?
<CFIF
FileExists(ExpandPath("Images\#Trim(Session.Client_ID)##Trim(Session.Insured_ID)#1.jpg"))>
<INPUT Type="button" Value="View Certificate - page 1" Name="Search1"
onClick="window.location='http:\CVS3WP14.CFM'">
<INPUT Type="button" Value="View Certificate - page 2" Name="Search1"
onClick="window.location='http:\CVS3WP15.CFM'">
</CFIF>
The .jpg image does exist. I don't get a error but it doesn't display the
buttons either. Help will be appreciated. TIA.
Regards,
Paige
Author: Matthew Walker
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124333
I find a good way to debug this is to display it then eyeball it:
!<cfoutput>#ExpandPath("Images\#Trim(Session.Client_ID)##Trim(Session.Insure
d_ID)#1.jpg")#</cfoutput>!
----- Excess quoted text cut - see Original Post for more -----
Author: Paige Chandler
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:24723#124331
Hello All,
Is the following the correct usage of ExpandPath?
<CFIF
FileExists(ExpandPath("Images\#Trim(Session.Client_ID)##Trim(Session.Insured_ID)#1.jpg"))>
<INPUT Type="button" Value="View Certificate - page 1" Name="Search1"
onClick="window.location='http:\CVS3WP14.CFM'">
<INPUT Type="button" Value="View Certificate - page 2" Name="Search1"
onClick="window.location='http:\CVS3WP15.CFM'">
</CFIF>
The .jpg image does exist. I don't get a error but it doesn't display the buttons
either. Help will be appreciated. TIA.
Regards,
Paige
|
May 24, 2012
|
Latest Fusion Authority Articles
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||