I had to make a search function that find certain files on my server, that part works, and returns the full root path to a file...
but what I need to figure out is the URL to that file, so that I can turn it into a clickable link...
Do you know the path to your webroot? (you should) you could then do a str_replace to change the path to webroot to the base url. For me it would be as simple as
$url = str_replace(DOC_ROOT,SITE_URL,$file);
Just a thought off the top of my head (untested):
$regexp = '/^'.preg_quote(realpath($_SERVER['DOCUMENT_ROOT'])).'/'; $someFile = realpath($whatever_your_function_returns); $url = preg_replace($regexp, '', $someFile); echo "<a href='$url'>Click Me</a>";
Thank you both!!