saiful saiful - 5 months ago 41
PHP Question

one upload directory for two laravel project

two laravel project are installed under root and root/superadmin in my domain. both project has upload feature. so i want a common upload directory for both.

I tried public_path('/uploads/') which points to public/uploads for each larave. Is they any way to configure upload image goes to like "public_html/uploads/" and from both project can access them .


Answer Source

You can change your config file to include an absolute path. In config/filesystems.php set root to the absolute path of your upload folder.

'public' => [
    'driver' => 'local',
    'root' => /var/absolute/path/goes/here,
    'url' => env('APP_URL').'/storage',
    'visibility' => 'public',