PDA

View Full Version : How do I get the file name


bcarl314
06-13-2003, 01:34 PM
I would like to be able to extract the filename from an URL like this

http://mysub.mysite.com/dir1/dir2/myPhpFile.php?action=action&other=stuff

And I want to extract only "myPhpFile.php"

If I use $PHP_SELF I get /dir1/dir2/myPhpFile.php

I need to eliminate the "/dir1/dir2/" from that. Any ideas?

Thanks

bcarl314
06-13-2003, 01:38 PM
Nevermind, as usual, right after I post something I found the answer


$fileName = basename($PHP_SELF);

seems to do what I want.

Thanks

Spookster
06-13-2003, 04:42 PM
http://www.codingforums.com/showthread.php?s=&threadid=16645&highlight=PHPSELF+script+name