how to get public file path code example

Example 1: path of app directory in controller laravel

How to get base path(Project Root) in laravel ?
base_path(); // Path of application root


How to get storage folder path in laravel ?
storage_path(); // Path of storage/


How to get app folder path in laravel ?
app_path(); // Path of app/

Example 2: laravel get public path url

// Path to the project's root folder    
echo base_path();

// Path to the 'app' folder    
echo app_path();        

// Path to the 'public' folder    
echo public_path();

// Path to the 'storage' folder    
echo storage_path();

// Path to the 'storage/app' folder    
echo storage_path('app');

Tags:

Php Example