Re: how to trim file path from filename
- From: Bart Van der Donck <bart@xxxxxxxxxx>
- Date: Mon, 31 Mar 2008 08:24:43 -0700 (PDT)
andyau wrote:
I am uploading a file to the server and at the same time I want to
place the file name in to a database.
But for the the file to be effective I need to trim the path from the
filename and leave just the filename.
Can anyone suggest how I do this?
The traditional directory separator is regular slash ('/'), but Winoid
systems generally use backslash ('\'). But a file or directory name in
UNIX may contain backslash as well.
One way is to detect which of the slashes comes first, and take that
as separator for what follows. This should be a reasonably safe
assumption (I can't think of an alternative criterion).
Hope this helps,
--
Bart
.
- Follow-Ups:
- Re: how to trim file path from filename
- From: Tom Cole
- Re: how to trim file path from filename
- References:
- how to trim file path from filename
- From: andyau
- how to trim file path from filename
- Prev by Date: Re: Javascript Focus() - not playing friendly
- Next by Date: Re: dynamically loaded DIV
- Previous by thread: how to trim file path from filename
- Next by thread: Re: how to trim file path from filename
- Index(es):
Relevant Pages
|