I want to know the root of the application both system eg. /var/www/app/
or /app/
for the purposes of file uploads. When I upload, I believe I need the "system" directory name, for use to links in web front end, I need the "relative" path. How do I get this information?
In a previous project, I defined constants in the app*.php
files (front controller)
define('APP_ROOT', __DIR__);
Wonder if theres a better way?
In any ContainerAware
class you can get location of web directory by,
$this->container->get('kernel')->getRootdir().'/../web';
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