473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
Jul 19 '05 #1
3 7839
aPath = Split("/" & REquest.ServerVariables("PATH_INFO"), "/")
sFilename = aPath(UBound(aPath))

Ray at work

"Lin Ma" <a@a.com> wrote in message
news:Om***************@TK2MSFTNGP10.phx.gbl...
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

Jul 19 '05 #2
Lin Ma wrote on 03 okt 2003 in microsoft.public.inetserver.asp.general:
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?


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)
Jul 19 '05 #3
Thank you all.

Both snippets are working grate.

Lin Ma
"Lin Ma" <a@a.com> wrote in message
news:Om***************@TK2MSFTNGP10.phx.gbl...
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

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
14
by: Xah Lee | last post by:
Just bumped into another irresponsibility in perl. the crime in question this time is the module File::Basename. Reproduction: 1. create a directory containing a file of this name:...
4
by: M P | last post by:
Can you help me find an asp code that will upload a file from my PC to web server? Mark
8
by: Sam Collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8"...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
0
by: rautsmita | last post by:
hello friends , i am using to jdk6 and JAXB2.0, i have geomtry.xsd file i am trying to compile this file using jaxb but i got some error i.e.The particle of the type is not a valid restriction of...
1
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.