hi,
I have a problem deleting a file in a MAMP location. the file is not found in the public directory - but the path shown in the exception is correct?
here is my code:
Storage::delete(public_path() . '/storage/' . $media['file']);
// will result to Applications/MAMP/htdocs/laravel/public/storage/myfile.jpg
what is going wrong?
files are deleted by apache/php. make sure the apache user can write to the storage folder (public/storage)
Are you sure that the path is correct? Because laravel already comes with a storage folder (which is outside of the public folder).
Also if you use the Storage facade I think you can configure a root path which will always be prepended. You should check that in your config since that may result in something like Applications/MAMP/htdocs/laravel/storage/Applications/MAMP/htdocs/laravel/public/storage/myfile.jpg
the path is correct - with cd /Applications/MAMP/htdocs/laravel/public/storage/ - I am in the correct directory and the image is in there ...
I do not use storage_path() - this is outside the public folder - I know ...
apache/php can write to the folder - the upload of the images are working properly. maybe I give a try with unlink or transfer the site to a production server and try there ...
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community