Get the name of the file using substr
Monday, December 10th, 2007Hi guys,
Here the php code to get the actual name of the file. This is very usefull when you need to get the name of the file and you only have the full path like /download/games/getfile.php. To get the name I use the $_SERVER[”PHP_SELF”] var.
Here the code:
-
$file = substr(strrchr($_SERVER["PHP_SELF"],"/"),1);
If $_SERVER[”PHP_SELF”] is /download/games/getfile.php the value of $file is getfile.php
Yes, I know, it’s very simple, but (at least for me) very usefull
Posted in Php, tip | No Comments »

