Hi ,
I m using the HttpPostedFile.FileName Function in order to get the file name
but i m getting the fully-qualified name which is not good for me .
how can i get only the file name without the path .
For Instance ,
if i m sending the file "C:\MyFiles\Test.txt"
then the result will be "Test.txt"
Best Regards ,
Tiraman :-) 5 14257
BTW
i m not look for a way to get the short file name by doing some code like
this
Dim iPos as Integer
Dim iPosSave as Integer
Dim sPath as string = "c:\temp\test\test.txt"
iPos = 1
Do
iPos = InStr(iPos, sPath, "\")
If iPos = 0 Then Exit Do
Else
iPos = iPos + 1
iPosSave = iPos - 1
End If
Loop
response.write(Trim(Mid(sPath, iPosSave + 1)))
i m looking for some method in VB.NET which doing this already .
10x
"Tiraman" <ti*****@netvision.net.il> wrote in message
news:uR**************@TK2MSFTNGP11.phx.gbl... Hi ,
I m using the HttpPostedFile.FileName Function in order to get the file
name but i m getting the fully-qualified name which is not good for me .
how can i get only the file name without the path .
For Instance ,
if i m sending the file "C:\MyFiles\Test.txt"
then the result will be "Test.txt"
Best Regards ,
Tiraman :-)
Hi Tiraman,
Somewhere bellow you find a discussion about this, however the answers are
dim filename as string = Path.GetFileName("c:\temp\test\test.txt")
or in the same context
Path.GetFileNameWithoutExtension
I hope this helps?
Cor BTW i m not look for a way to get the short file name by doing some code like this
Dim iPos as Integer Dim iPosSave as Integer Dim sPath as string = "c:\temp\test\test.txt"
iPos = 1
Do iPos = InStr(iPos, sPath, "\") If iPos = 0 Then Exit Do Else iPos = iPos + 1 iPosSave = iPos - 1 End If Loop response.write(Trim(Mid(sPath, iPosSave + 1)))
i m looking for some method in VB.NET which doing this already .
10x
"Tiraman" <ti*****@netvision.net.il> wrote in message news:uR**************@TK2MSFTNGP11.phx.gbl... Hi ,
I m using the HttpPostedFile.FileName Function in order to get the file name but i m getting the fully-qualified name which is not good for me .
how can i get only the file name without the path .
For Instance ,
if i m sending the file "C:\MyFiles\Test.txt"
then the result will be "Test.txt"
Best Regards ,
Tiraman :-)
Hello Cor
This Is What i was looking for :-)
10x
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl... Hi Tiraman,
Somewhere bellow you find a discussion about this, however the answers are dim filename as string = Path.GetFileName("c:\temp\test\test.txt") or in the same context Path.GetFileNameWithoutExtension
I hope this helps?
Cor
BTW i m not look for a way to get the short file name by doing some code
like this
Dim iPos as Integer Dim iPosSave as Integer Dim sPath as string = "c:\temp\test\test.txt"
iPos = 1
Do iPos = InStr(iPos, sPath, "\") If iPos = 0 Then Exit Do Else iPos = iPos + 1 iPosSave = iPos - 1 End If Loop response.write(Trim(Mid(sPath, iPosSave + 1)))
i m looking for some method in VB.NET which doing this already .
10x
"Tiraman" <ti*****@netvision.net.il> wrote in message news:uR**************@TK2MSFTNGP11.phx.gbl... Hi ,
I m using the HttpPostedFile.FileName Function in order to get the
file name but i m getting the fully-qualified name which is not good for me .
how can i get only the file name without the path .
For Instance ,
if i m sending the file "C:\MyFiles\Test.txt"
then the result will be "Test.txt"
Best Regards ,
Tiraman :-)
* "Tiraman" <ti*****@netvision.net.il> scripsit: how can i get only the file name without the path .
For Instance ,
if i m sending the file "C:\MyFiles\Test.txt"
\\\
Imports System.IO
..
..
..
Dim FileName As String = Path.GetFileName("C:\MyFiles\Test.txt")
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
10x :-)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2h************@uni-berlin.de... * "Tiraman" <ti*****@netvision.net.il> scripsit: how can i get only the file name without the path .
For Instance ,
if i m sending the file "C:\MyFiles\Test.txt"
\\\ Imports System.IO . . . Dim FileName As String = Path.GetFileName("C:\MyFiles\Test.txt") ///
-- Herfried K. Wagner [MVP] <URL:http://dotnet.mvps.org/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: S.W. Rasmussen |
last post by:
With the risk of being accused of multi-posting I would like to draw the
attention to a serious visual basic/windows issue discussed in the
microsoft.public.vb.bugs newsgroup. As pointed out below...
|
by: hokiegal99 |
last post by:
How would I determine if a filename is greater than a certain number
of characters and then truncate it to that number? For example a file
named XXXXXXXXX.txt would become XXXXXX
fname = files...
|
by: Michael |
last post by:
All,
I'll asked a question but I was not detailed (clear) enough for people to
help so I'll retry.
I have a cgi script pass a variable from one page to the next. The
'receiving' page replaces...
|
by: Brian Gruber |
last post by:
Hi, I'm looking for a way to rename a whole directory of files in short
order. The files in the directory have different lengths, however all
of them end with _xxxx the x's represent a randomly...
|
by: Lad |
last post by:
Hello,
what is a way to get the the extension of a filename from the path?
E.g., on my XP windows the path can be
C:\Pictures\MyDocs\test.txt
and I would like to get
the the extension of the...
|
by: IamIan |
last post by:
I searched the archives but couldn't find anyone else with this
problem. Basically I'm grabbing all ASCII files in a directory and
doing geoprocessing on them. I need to calculate a z-factor based...
|
by: B Squared |
last post by:
I'm trying to pass a filename (which is a jpeg image) to a php
function / file so that it will display. I know that its simple
to get PHP to display an image hardcoding in the filename. For...
|
by: Steve |
last post by:
I am trying to create a downloader which will bypass the saveas box in the
WebBrowser control. I have the file downloading, but I don't know what the
filename is that is being passed through the...
|
by: jinnareddy |
last post by:
Hi,
I'm unable to download a file that is having a 2-byte char in its name (e.g.テ) using force download option. Though, am able to download file names involving ASCII chars. I have tried URL...
|
by: vj |
last post by:
I am using Borland C++.
I run a program which generates output data files, say 'Voltage.dat',
'Current.dat'. I have a variable in my code (say N), and for various
values of N (for each value of...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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...
| |