EasyCFM.COM ColdFusion Forums / PHP to CFML / php basename function in Coldfusion

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: php basename function in Coldfusion

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

kurt
02-27-2008 @ 6:14 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 4
Joined: Dec 2007

Is there a function in Coldfusion similar to the basename function in php?

In php, basename will return a file name from a string containing a the whole path to the file.

How would I do this in Coldfusion?

louissto56
02-28-2008 @ 10:12 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1149
Joined: Jan 2007

ExpandPath()???

e.g. #ExpandPath("../images/logo.jpg")# will return C:/CF8/wwwroot/site/images/logo.jpg

Louis

-----------------------------
www.MyBizList.com.au - QLD Business Directory and rent-a-site

kurt
02-29-2008 @ 9:49 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 4
Joined: Dec 2007

No, ExpandPath() is the opposite of what I needed to do.  However, when I looked it up on cfquickdocs, I found the function GetFileFromPath() which is what I needed.

Thanks.

This message was edited by kurt on 2-29-08 @ 9:54 AM

louissto56
03-01-2008 @ 12:28 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1149
Joined: Jan 2007

Oh I see what you mean. Another way is this:

#ListLast(path,"/")# That will return the filename

Eitherway Smile

Louis

-----------------------------
www.MyBizList.com.au - QLD Business Directory and rent-a-site


Website Designed and Developed by Pablo Varando.