I want to delete these files in my laravel like this. But it doesnt work!!
use Storage;
class SomeController extends Controller
{
public function delete()
{
$filesToDelete = [
'http://minio:9100/minio/myapp/1/ImNkE0wwrstgSpzFyruw8.jpeg',
'http://minio:9100/minio/myapp/1/YFrdE0sarsAcpfFyrifd2.jpeg'
];
// cant delete using this
Storage::disk('s3')->delete($filesToDelete);
}
}
But when I try to delete using this command in my bash it works perfectly
aws --endpoint-url http://minio:9100 s3 rm s3://myapp/1/ImNkE0wwrstgSpzFyruw8.jpeg
delete: s3://myapp/1/ImNkE0wwrstgSpzFyruw8.jpeg
my aws configure list is exactly the same in my project config! I can use Storage to upload the files but when I try to delete the files it doesnt work:
// Working
Storage::disk('s3')->put('1/ImNkE0wwrstgSpzFyruw8.jpeg', $file);
Am I doing something wrong? Is there anyway to delete these files using laravel??
https://docs.min.io/docs/aws-cli-with-minio https://readouble.com/laravel/5.4/en/filesystem.html
I think the problem is file path. Try to run as mentioned below.
Storage::disk('s3')->delete('myapp/1/ImNkE0wwrstgSpzFyruw8.jpeg');