How to get file name from a URL using PHP
Last Modified at 2019-06-25 21:29:25
Are you creating an application in which you require a functionality that will copy the file from a given URL and then store into a directory and while coping the file you want to get filename of from given URL and then you want rename that according to your requirement. Am I right? Here, I an going to write a code that will help us to get file name from a URL using PHP inbuilt function basename()
Here is the code:
Above code will output the file name as 'image.png'.