Report this

What is the reason for this report?

How to delete files using laravel

Posted on October 23, 2020

I am using DigitalOcean Spaces as a configured disk in Laravel and was having a problem with deletion of file using the following codes:

Source: https://laravel.com/docs/5.5/filesystem#deleting-files

Storage::disk('spaces')->delete('foldername/'.$fileName);

I have no problem uploading photos but I wanna have an option of replacing a file when a new one is uploaded. I tried this using my local disk and it worked, but when using do_spaces disk, nothing happens. I can even check that the file exists by using Storage::disk('spaces')->exists('foldername/'.$fileName); before trying to delete.

I am not sure if this is an issue in do spaces or is delete function like above is not supported here. Any idea what I’m doing wrong? Thanks

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.