Search code examples
phplaravel-5laravel-storage

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.


Solution

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

      Storage::delete('identification_cards/'.$filename);