Copy link to clipboard
Copied
Is there a CF 8 function that will give me the url path for an a known OS absolute path.
For example if I have a path to a file or directory like:
C:\Inetpub\wwwroot\ccradius\public\applications\cruzcontrol\uploads\uploadpics\badday1.jpg
OR
C:\Inetpub\wwwroot\ccradius\public\applications\cruzcontrol\uploads\uploadpics\
Thanks for any help!!!
No, there's no such function. It's a bit tricky to automate because a directory on the file system could be mapped in any number of ways on the CF server, and there's no automatic way for CF to second-guess which mapping you'd want to be using.
Basically what you need to do is to use expandPath() to expand a mapping that you want to use to resolve the file system path into a URL, and then look for a match of that in the path you are trying to convert. If it's there, chop the file system path ac
...Copy link to clipboard
Copied
No, there's no such function. It's a bit tricky to automate because a directory on the file system could be mapped in any number of ways on the CF server, and there's no automatic way for CF to second-guess which mapping you'd want to be using.
Basically what you need to do is to use expandPath() to expand a mapping that you want to use to resolve the file system path into a URL, and then look for a match of that in the path you are trying to convert. If it's there, chop the file system path accordingly (and flip the slashes around if needs must).
EG:
Your path:
C:\Inetpub\wwwroot\ccradius\public\applications\cruzcontrol\uploads\uploadpics\b adday1.jpg
Your root mapping:
/ => C:\Inetpub\wwwroot\ccradius\
So expandPath("/") resolves to C:\Inetpub\wwwroot\ccradius\
Now use replace() to get rid of that bit of the path from your target path:
public\applications\cruzcontrol\uploads\uploadpics\b adday1.jpg
Prepend the mapping (which is just "/" in this case):
/public\applications\cruzcontrol\uploads\uploadpics\b adday1.jpg
Use replace() to substitute the \ with /
/public/applications/cruzcontrol/uploads/uploadpics/b adday1.jpg
--
Adam
Copy link to clipboard
Copied
Thanks for the help!!
Carlos