Search code examples
phplaravelflysystem

Flysystem file not found when deleting


I'm trying to delete a photo with Laravel 5.

Storage::delete( asset('/uploads/slides/abcd.jpg'));

Its returning this error:

FileNotFoundException in Filesystem.php line 428:
File not found at path: http:/localhost:8000/uploads/slides/abcd.jpg

If I copy and paste the path in the browser it opens the file so the file really exists. Whats wrong?


Solution

  • I found the solution.

    I had to change the root path in config/filesystem.php because it was looking the file in the old defined path (the storage path)

    This is the modified version

    'disks' => [
    
        'local' => [
            'driver' => 'local',
            'root'   => public_path(),
        ],
    ]