laravel-medialibrary: The storage path is not part of the public path
Hi,
I get the following error, using latest laravel.
UrlCouldNotBeDetermined in LocalUrlGenerator.php line 19:
The storage path is not part of the public path
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (4 by maintainers)
I fixed issue by adding a
url
to thedisk
like below:I’m having this issue whereby my
public/media
is symlinked tostorage/media
(ln -s ../storage/media public/media
from project root) but therealpath()
function expands the symlink.The solution is to remove the
realpath()
from the return inLocalUrlGenerator::getStoragePath()
.@WolfieZero that has fixed the problem thanks, but should it be added to the repo?
I’m facing this exact same problem, it looks like I’ve done everything correctly, but I still get the same exception. What for me seems to be a problem is this method:
The first line returns the correct path
/home/vagrant/website/public/storage/media
. But the call torealpath()
turns the path into/home/vagrant/website/storage/app/public/media
.What am I doing wrong?
Be careful and understand what disk you are using. Local does not mean to be public. Public is for real public resources. (According to the default disk from a fresh Laravel installation)