Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 08:44 AM
Lin Ma
Guest
 
Posts: n/a
Default Get File name

Hi,

Is there are an easy way to get the file name from the URL address.

My web url is like: http://servername/foldername/filename.asp

I want to get only filename.asp

Do I need to do request.servervariables("PATH_INFO") then trim it and left
only filename.asp?

Or there is a easy way?

Thanks,

Lin Ma


  #2  
Old July 19th, 2005, 08:44 AM
Ray at
Guest
 
Posts: n/a
Default Re: Get File name

aPath = Split("/" & REquest.ServerVariables("PATH_INFO"), "/")
sFilename = aPath(UBound(aPath))

Ray at work

"Lin Ma" <a@a.com> wrote in message
news:Om3kB%23ciDHA.604@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hi,
>
> Is there are an easy way to get the file name from the URL address.
>
> My web url is like: http://servername/foldername/filename.asp
>
> I want to get only filename.asp
>
> Do I need to do request.servervariables("PATH_INFO") then trim it and left
> only filename.asp?
>
> Or there is a easy way?
>
> Thanks,
>
> Lin Ma
>
>[/color]


  #3  
Old July 19th, 2005, 08:45 AM
Evertjan.
Guest
 
Posts: n/a
Default Re: Get File name

Lin Ma wrote on 03 okt 2003 in microsoft.public.inetserver.asp.general:
[color=blue]
> Is there are an easy way to get the file name from the URL address.
>
> My web url is like: http://servername/foldername/filename.asp
>
> I want to get only filename.asp
>
> Do I need to do request.servervariables("PATH_INFO") then trim it and
> left only filename.asp?
>
> Or there is a easy way?
>[/color]

url = "http://servername/foldername/filename.asp"

result = mid(url,InStrRev(url,"/")+1)

[tested]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
  #4  
Old July 19th, 2005, 08:45 AM
Lin Ma
Guest
 
Posts: n/a
Default Re: Get File name

Thank you all.

Both snippets are working grate.

Lin Ma


"Lin Ma" <a@a.com> wrote in message
news:Om3kB%23ciDHA.604@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hi,
>
> Is there are an easy way to get the file name from the URL address.
>
> My web url is like: http://servername/foldername/filename.asp
>
> I want to get only filename.asp
>
> Do I need to do request.servervariables("PATH_INFO") then trim it and left
> only filename.asp?
>
> Or there is a easy way?
>
> Thanks,
>
> Lin Ma
>
>[/color]


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles