That is not about getting file name from the url of current page. I have a php file like that.
You can also use string functions like strrpos to get the last position of '/' and then use the substr and strlen functions to get the last part of the string.
$fileurl = 'http://example.com/filepath/filepath2/myfile.doc'; $file_name=substr($fileurl,strrpos($fileurl,'/')+1,strlen($fileurl));
echo $file_name;