Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert FSO path to HTTP path 1

Status
Not open for further replies.

rubychyld

Programmer
Mar 22, 2001
76
0
0
US
I am reading a folder of files off the web box and would like to make make these files links. Is there a method or function that will convert the FSO path to the HTTP path??

convert this FSO:
C:\Inetpub\ Lease Application.pdf

to this HTTP:
Lease Application.pdf

Liz Catch the vigorous horse of your mind!
 
do you need the absolute URL or will a relative link work?
 
either the absolute or the relative would be fine
I could concatonate the relative with Request.ServerVariables("SERVER_NAME") or something right?

I suppose I could just replace the first part of the string with the http: info, but I am actually reading from more than a few different locations and this would be a long case statement.

thanks for any help.
Liz Catch the vigorous horse of your mind!
 
Code:
' / is c:\inetpub\[URL unfurl="true"]wwwroot[/URL] in this example
strRootWeb = server.mappath("/")

'the filename would come from an FSO, but we'll hard
'code it for this example
strFilename = "c:\inetpub\[URL unfurl="true"]wwwroot\intranet\product\auto.pdf"[/URL]

'remove the base path from the filename
strFilename = right(strFilename, len(strFileName) - len(strRootWeb))

'we should have \intranet\product\auto.pdf as strFilename
strFilename = replace(strFilename, "\", "/")

'we should have /intranet/product/auto.pdf as strFilename

URL = "[URL unfurl="true"]http://"[/URL] & request.servervariables("SERVER_NAME") & strFilename

.
.. Eat, think and be merry .
... ....................... .
 
I would make constants of specific portions pertaining to your system / web ie

Const strSysWebRoot = "C:\Inetpub\Const strDomainName = "
etc... then just

strURL = Replace(strPath, strSysWebRoot, " & strDomainName)

strURL = Replace(strURL, "\", "/")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top