I often find that I have files in my projects that need to be accessed from the file system as well as the users browser. One example is uploading photos. I need access to t
I've used this and worked with me:
$file_path=str_replace('\\','/',__file__); $file_path=str_replace($_SERVER['DOCUMENT_ROOT'],'',$file_path); $path='http://'.$_SERVER['HTTP_HOST'].'/'.$file_path;
And if you need the directory name in url format add this line:
define('URL_DIR',dirname($path));