Confused on using basename...

From: Sean Berry (sean_berry_at_cox.net)
Date: 04/14/04


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.



Relevant Pages

  • Re: automated upload with PHP
    ... have your script one once per day and upload any images not already ... tiffs and the php script, ... // request local file read permission ...
    (comp.lang.php)
  • [UNIX] Cobalt Raq XTR Combination Attack (Remote/Local)
    ... Due to an authentication bug in the upload Handler, ... The next problem lies in the base64 encoding of the filename, ... After the symlinks have been created (script to create base64 symlink is ...
    (Securiteam)
  • Re: automated upload with PHP
    ... have your script one once per day and upload any images not already ... providing it can have an ftp serve running on it, ... tiffs and the php script, ...
    (comp.lang.php)
  • Re: automated upload with PHP
    ... have your script one once per day and upload any images not already ... providing it can have an ftp serve running on it, ... tiffs and the php script, ...
    (comp.lang.php)
  • Re: Help with Ademco Vista 50P
    ... find Compass that hard to use, except for my stupidity in what download and upload mean, at least when using Compass... ... my customers gets alarm software I warn them that "upload" and "download" in the alarm world mean the opposite of what they seem. ... I did an initial upload of the customer data back in 97 or so, then never went any further until yesterday. ...
    (alt.security.alarms)