0

two Laravel project are installed under root and root/superadmin in my domain. both projects have upload feature. So I want a common upload directory for both.

I tried public_path('/uploads/') which points to public/uploads for each Laravel. Are they any ways to configure upload image goes to like public_html/uploads/ and from both projects I can access them.

Ivan
  • 34,531
  • 8
  • 55
  • 100
saiful
  • 129
  • 2
  • 12

1 Answers1

0

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',
]
...
Edwin
  • 1,135
  • 2
  • 16
  • 24
  • 'root' => 'public_html/uploads/', do you mean it for both application ? thanks – saiful Aug 17 '17 at 07:35
  • Yup but 'public_html/uploads/' is a relative path. See also: https://stackoverflow.com/questions/21306512/difference-between-relative-path-and-absolute-path-in-javascript – Edwin Aug 17 '17 at 07:58