Skip to content
Advertisement

PHP display current server path

I need to setup a path in my php but I currently don’t know the path.

I need to configure the paths to the uploads directory

Should look like this below:

/srv/www/uploads/

My uploads.php file is in the root…so

www/uploads/ ???

Is there anyway that I could get php to tell me my current path?

Advertisement

Answer

If you call getcwd it should give you the path:

<?php
  echo getcwd();
?>
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement