ajithlal's avatar

Hitting error while uploading image to s3 - laravel 9

Hi All, I was trying to upload image to s3 and hitting the below error. Class "League\Flysystem\AwsS3V3\PortableVisibilityConverter" not found below is my code

//$image is $request->file('image');
$extension  = $image->getClientOriginalExtension();

$fileName  = md5(Str::random(5) .$image->getClientOriginalName() . time()) . '.' . $extension;

Storage::disk('s3')->put($path . $fileName, $image, 'public');

tried below one also

$extension  = $image->getClientOriginalExtension();

$fileName  = md5(Str::random(5) .$image->getClientOriginalName() . time()) . '.' . $extension;

Storage::disk('s3')->put($path . $fileName, file_get_contents($image), 'public');
0 likes
8 replies
ajithlal's avatar

@tykus I don't know how, but the package was in my composer json and it was missing from the vendor folder. I'm sure that I have run the composer install and composer update command. After I deleted the lock file and run the composer install, it worked.

tykus's avatar

@ajithlal If the package installed correctly, then the class should be available. Try composer dump-autoload first, otherwise re-install the package ensuring composer finishes successfully

1 like
kokleng's avatar

@ajithlal So, We must delete the composer..lock file, right? Then run composer update again? Because i also get this problem in hosting but it work normal in local machine. error message : "League\Flysystem\AwsS3V3\PortableVisibilityConverter" not found

ajithlal's avatar

@kokleng in my case it worked after deleting the composer.lock file and run the composer update. You can try the same or as @tykus said, try running composer dump-autoload. Hope that will fix.

kuldeep_1403's avatar

i also get the same error. so i delete my composer.lock file and then run composer update and composer dupm-autoload but it's not working it still giving same error.. on server

Please or to participate in this conversation.