S
Sean Berry
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.
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.