Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storage::delete not deleting the file. The path is correct and the file permissions are correct

I do not know why I am not able to delete a file in Laravel with the code:

$path = storage_path('app/identification_cards') . '/' . $filename;
Storage::delete($path)

The command is executed without errors and it returns true.

What I checked:
- the path is correct. If I use the same exact path in a bash terminal (with the "rm" command) the file is deleted;
- the file does have 777 permissions.

I don't know how to solve it.

Thanks.

like image 408
Giacomo M Avatar asked Sep 14 '25 21:09

Giacomo M


1 Answers

Storage::delete will point to storage\app\ path so no need to add app folder name once again

  Storage::delete('identification_cards/'.$filename);
like image 123
Vision Coderz Avatar answered Sep 16 '25 11:09

Vision Coderz