We help IT Professionals succeed at work.

Problem with coldfusion- expandpath

Panos
Panos asked
on
Hello experts.
I have my main img path:sitename/img.

Now i want to handle these images.
sitename/admin/components/styling/updateimages.cfm.

I have here the problem to specify wich is the image path using the expandpath in the updateimages.cfm.

<CFSET thispath = expandpath(???)>

Any help?
Comment
Watch Question

Commented:
<cfset thisPath = expandPath('.') />

Will give you the current path

Author

Commented:
Hi Plucka
I put <cfset thisPath = expandPath('.') /> in my updateimages.cfm page and i'm getting a wrong path again.
Using cfdump for the thispath i get:
C:\Inetpub\wwwroot\sitename\Admin\components\styling

my image path is
C:\Inetpub\wwwroot\sitename\img

 
Most Valuable Expert 2015
Commented:
"." will give you the path of the current template. If you want the path C:\Inetpub\wwwroot\sitename\img, try:

<cfset thisPath = expandPath("/sitename/img/") />

Where "/" indicates the web root

Author

Commented:
Hi agx.

I don't know why but this is working for me:expandPath('/img/')
Most Valuable Expert 2015
Commented:
That's fine.  You probably have a virtual mapping for "sitename", so that it's your web root ie "/".  So ExpandPath("/") equals C:\Inetpub\wwwroot\sitename\.  So using expandPath('/img/') is fine.



Author

Commented:
Thank you for your help
regards
panos