How to get file name from a URL using PHP
Last Modified at 2020-03-22 18:03:52
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'.