Sunday, March 31, 2013

Image Upload from a URL Using Php

By PHP, you need to strip the path from a URL, leaving behind just the filename at the end of the URL. You can do this with a regular expression pattern of course, but I have a much simpler solution. See the example code below.

Get filename from a URL Using Php

 Example : 

 $url = "http://www.iconarchive.com//path/to/file/filename.php";

 $filename = basename($url);

 echo $filename; //filename.php

No comments:

Post a Comment

Thanks....