Relative paths
For the web server root directory, use:
$folder = '/';
For the directory of the extracted script use:
$folder = './';
Absolute paths (from the point of view of the client)
For the web server root directory, use:
$protocol = $_SERVER['HTTPS'] == '' ? 'http://' : 'https://'; $folder = $protocol . $_SERVER['HTTP_HOST'];
For the directory of the extracted script use:
$protocol = $_SERVER['HTTPS'] == '' ? 'http://' : 'https://'; $folder = $protocol . $_SERVER['HTTP_HOST'] . '/' . basename($_SERVER['REQUEST_URI']);
source share