Confused on using basename...
From: Sean Berry (sean_berry_at_cox.net)
Date: 04/14/04
- Next message: The Dead Bishop: "PDF::Create"
- Previous message: John Jardine: "Re: s/// has apparent side effect on grep()"
- Next in thread: Joe Smith: "Re: Confused on using basename..."
- Reply: Joe Smith: "Re: Confused on using basename..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 13 Apr 2004 18:33:33 -0700
I have an online ftp type website for a customer that I wrote in a cgi perl
script.
If the person is trying to upload a file that already exists on the server I
am printing a message telling them to delete the original first.
My problem is this...
In order to compare the given file with what is in the database, I need to
get the name of the file by itself (without the full path). So, if someone
uploads a file on windows... I should extract file.txt from C:\Documents and
Settings\All Users\Documents\file.txt
I can do this using regular expressions, but want to have one command that
will work on any system rather than doing a different regex based on the
users os. I tried using:
$filename = basename($path);
But this does not seem to be working. Am I missing something, or is there a
better way to do this.
TIA for any help.
- Next message: The Dead Bishop: "PDF::Create"
- Previous message: John Jardine: "Re: s/// has apparent side effect on grep()"
- Next in thread: Joe Smith: "Re: Confused on using basename..."
- Reply: Joe Smith: "Re: Confused on using basename..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|