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!

Getting the filename of the page and ONLY the filename?

Status
Not open for further replies.

pha2er

Programmer
Dec 4, 2001
16
GB
Hi there,

using Request.Servervariables("path_info") I can get the following:

/dev/html/sendarticle.asp

But I only need "sendarticle.asp", does anyone know how I can get this?

cheers!
 
Well, i'm not too familiar with vbscript ( which is why I'm hanging out here ), but you could try it this way:
Code:
Set sPath = Request.Servervariables("path_info")
aFile = split(sPath, "/")
'the filename you want would be in aFile(UBound(aFile))
'last index of the aFile array

But i'm sure someone has a better way to get to that info :) I'm not even sure if my syntax is correct ... [peace]
 
lcPath = Request.ServerVariables("SCRIPT_NAME")
lnAt = InStrRev(lcPath,"/",-1,1)
lcPage = Mid(lcPath,lnAt+1)
Response.Write lcPage Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top