Sunday, May 29, 2011

Get File name from URL Path - ASP Classic

The following VBScript function can be used in an ASP legacy application to extract the file name from a request.

public function GetFileName()
dim files, url, segments

'get then current url from the server variables
url = Request.ServerVariables("path_info")

segments = split(url,"/")

'read the last segment
url = segments(ubound(segments))
GetFileName = url
end function

No comments:

Post a Comment