Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFFILE and Site Root Path

New Here ,
Apr 14, 2006 Apr 14, 2006
I need to make a input field that will allow me to browse to a file and select the file and 'site root path' and save that to be used as a link.

I would like to store the value as /dirMain/subDir/file.cfm
I am lost ...Any Ideas...
889
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 15, 2006 Apr 15, 2006
Input field to browse to file, select file and webroot path and save that as link? I don't understand what that means. Does anyone, well, except Oldshoe?




Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 15, 2006 Apr 15, 2006
Sorry for the confusion.
I need to be able to show the path of any given file based off the root of the site [the base index.cfm] so instead of getting the full Expandpath(), I need to eliminate the C:websites/HostDirectory/Site/

THANKS

Jon
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2006 Apr 16, 2006
To get that relative path value on each page itself, you could just remove C:\websites\HostDirectory\Site\ from the absolute path, thus

<cfset relpath=ReplaceNoCase(ExpandPath( "myPage1.cfm"),"C:\websites\HostDirectory\Site\","")>

However, if you want code for myPage1.cfm that will find the relative path of any given arbitrary file, myPage2.cfm, then you could implement a search. The reason is, such a file may have an arbitrary directory structure, C:\websites\HostDirectory\Site\..\dir1\dir2\..\myPage2.cfm. I also wonder whether one could do it with code that searches using cfdirectory. I'm looking into it.



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 20, 2006 Apr 20, 2006
Just type in a value for the basepath (for example, C:\websites\HostDirectory\Site) and for the file (for example, testPage.cfm). Suppose the file's path is

C:\websites\HostDirectory\Site\subsite\myDir\files\new\testPage.cfm

Then the code's result will be:

filepath: C:\websites\HostDirectory\Site\subsite\myDir\files\new\testPage.cfm
filepath above basepath: \subsite\myDir\files\new\testPage.cfm




Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2006 Apr 21, 2006
Thank you, I will give it a shot...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2006 Apr 21, 2006
LATEST
!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources