473,419 Members | 1,615 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,419 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 7841
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.