cloudinary-community / cloudinary-laravel

Laravel SDK for Cloudinary
MIT License
255 stars 71 forks source link

Upload File from Disk -> MediaAlly #108

Open GLStephen opened 5 months ago

GLStephen commented 5 months ago

This fails because it's not an "SplFile" which supports "getRealPath", but the path there IS the real path.

$user->attachMedia(Storage::path($path), $file_name);

I'm trying to support Laraval Livewrire uploads which uploads to a temporary directory locally and then attach to a model and upload to Cloudinary.

This check: https://github.com/cloudinary-devs/cloudinary-laravel/blob/63400a9eab277bb2e0623feb5e1dc3c0bf0965a4/src/MediaAlly.php#L33

Seems incompatible with this: getRealPath call.

https://github.com/cloudinary-devs/cloudinary-laravel/blob/63400a9eab277bb2e0623feb5e1dc3c0bf0965a4/src/MediaAlly.php#L37

file_exists expects a string, while getRealPath expects an object.