In a previous version of my administration panel I had file uploads working with Minio, but after an update this stopped working completely which made me look for an alternative. Because of this I started look for an alternative service. In the last few days I saw some [posts](https://x.com/gonedark/status/1978458884948775294) from [Jason McCreary](https://x.com/gonedark) about CloudFlare which made check if they had an s3 complaint object storage and they have one.
Settings
--------
I'll assume you've already setup your CloudFlare (CF) account and created a bucket. In addition to that bucket you will need to update the CORS settings for the bucket in question with the information below.
```yaml
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE",
"HEAD"
],
"AllowedHeaders": [
"*"
],
"ExposeHeaders": []
```
Apart from the CF settings you will need to change the following code within your `config/livewire.php` file.
Set the `temporary_file_upload.disk` value as `s3` in order to directly to CF or Amazon S3. In my case I am using the s3 configuration with [R2](https://www.cloudflare.com/developer-platform/products/r2/).
Within filament I make use of the spatie media library but this also works with the normal `FileUploadField`. See my code example below.
```php
SpatieMediaLibraryFileUpload::make('image')
->disk(config('filesystems.default'))
->visibility('private')
->fetchFileInformation(false)
->image(),
```