codebar-ag / laravel-flysystem-cloudinary

Cloudinary Flysystem integration with Laravel.
https://www.cloudinary.com
MIT License
8 stars 5 forks source link

[Bug]: Not compatible with filament #63

Closed hamidroohani closed 1 month ago

hamidroohani commented 2 months ago

What happened?

FileUpload::make('logo')
    ->disk('cloudinary')
    ...

The file will upload successfully, but it doesn't appear in the table, and I also in the edit page occur an error: Unable to retrieve the file_size for file at location: 01J4GR1EFN8ERFPGD52SJY37S4.jpg

Screenshot 2024-08-05 at 09 49 28

Package Version

4.2.1

PHP Version

8.3

Laravel Version

11.0.0

Which operating systems does with happen with?

macOS, Linux

StanBarrows commented 2 months ago

Hey @hamidroohani

I'm unaware of how the file handling works within Filament. I assume you need to create a custom Filament Field for this, as we made a Field Component for Laravel Nova. Switching the driver is not working, as you may know from your previous issue #61.

https://github.com/codebar-ag/laravel-flysystem-cloudinary-nova

If you see an error within this package causing this, I'm happy to accept a PR. But at the moment, I do not have any plans to use this package within a filament project.

RhysLees commented 2 months ago

https://github.com/codebar-ag/laravel-flysystem-cloudinary?tab=readme-ov-file#-file-extension-problem

From first looks without testing, it seems your cloudinary file id is likley 01J4GR1EFN8ERFPGD52SJY37S4.jpg you should not upload files with the extension on the end as specified in the documentation linked above.

I would think you need to use something like the following in Filament to get this behaviour to work: https://filamentphp.com/docs/3.x/forms/fields/file-upload#generating-custom-file-names