Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storage delete is not working laravel

Tags:

php

laravel

i have image file in C:\xampp\htdocs\blog\storage\app\public\images\15201710351.jpg

and i am trying to delete it from images folder with Storage class

$post = Post::find($id);
Storage::delete(storage_path().'app/public/images/'.$post->image);

and with

Storage::delete(storage_path('app/public/images/'.$post->image));

also with this

Storage::delete(public_path().'/storage/images/'.$post->image);// i have created symbolic link

there is no error message, but it is not working. i am using laravel 5.6, anyone can help?

like image 980
Mamen Avatar asked Oct 19 '25 13:10

Mamen


1 Answers

The default public storage location is storage/app/public, so just pass in the images directory and filename like so:

Storage::delete('images/' . $post->image)

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!