Hello there, I would like to use the PHP function basename(); in my app. I am try to store the filename (not path) of an uploaded file in my database however when I upload from a windows machine the path slashes are \ and the basename() doesn't seem to like that as it stores the entire path. If I change the \ to a / then it all functions fine??? What gives? Example 2 is what I want to happen...do I have to change the slashes (how?) or is there a better way to do this.
Thanks,
Jamie
ex1:
<?PHP
$path = "\desktop\www\index.php";
$file = basename ($path);
echo $file;
?>
Result of echo: \desktop\www\index.php
ex2:
<?PHP
$path = "/desktop/www/index.php";
$file = basename($path);
echo $file;
?>
result of echo: index.php