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?
The __DIR__ can be used to obtain the current code working directory. It has been introduced in PHP beginning from version 5.3. It is similar to using dirname(__FILE__). Usually, it is used to include other files that is present in an included file. Consider the following directory structure −
dirname(__FILE__) allows you to get an absolute path (and thus avoid an include path search) without relying on the working directory being the directory in which bootstrap. php resides. (Note: since PHP 5.3, you can use __DIR__ in place of dirname(__FILE__) .)
Server path, absolute path and webroot are all different names for the same thing a path which defines where your files are located on the server.
If you call getcwd it should give you the path:
<?php echo getcwd(); ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With