webHauser Blog

Icon

Welcome to webHauser weblog

How to get the filename from an URL


$url = 'http://www.site.com/images/logo.gif';
$x = explode('/', $url);
$filename = trim($x[count($x)-1]);
echo $filename;

The code output will be “logo.gif”

Leave a Reply

You must be logged in to post a comment.