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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

absolute vs. relative path

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Using the FSO I am trying to open a text file using a relative path and display it in my web page. I can do this with an absolute path with no problem. When I remove the absolute path and use a relative path from my current directory I get file not found.

Here is the code:

Dim objFSO, absPath, relPath
absPath = ""
relPath = "textFiles\101.txt"

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(relPath)
absPath = objFile.Path

Dim objTextStream, ProjDescFullText

Set objTextStream = objFSO.OpenTextFile(absPath, 1)
ProjDescFullText = objTextStream.ReadAll

set objTextStream = Nothing
Set objFSO = Nothing
Set objFile = Nothing

Any help would be appriciated.
 
I don't think it will let you use relative paths. Try using object.GetAbsolutePathName(pathspec) to get the absolute path from the relative path, then use this in the opentextfile method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top