rtechshow's avatar

Error on S3 Uploading - Laravel 5

Hello I am using s3 to upload images and i am getting the error like below. Please help

FatalErrorException in FilesystemManager.php line 140:
Class 'League\Flysystem\AwsS3v2\AwsS3Adapter' not found

My Composer require

"require": {
        "laravel/framework": "5.0.*",
        "illuminate/html": "~5.0",
        "greggilbert/recaptcha": "2.*",
        "guzzlehttp/guzzle": "~6.0",
        "pda/pheanstalk": "3.0.2",
        "league/flysystem-aws-s3-v2": "~1.0"
},

I configuered s3 properly in filesystem

My Controller Code

use Illuminate\Contracts\Filesystem\Filesystem;
.........................................
 $pic = $request->file('pic');
        $picName = $user->activation_code . '.' . $pic->getClientOriginalExtension();
        
        $s3 = \Storage::disk('s3');
        $pickPath = '/'.$user->username.'/' . $picName;
        $s3->put($pickPath, file_get_contents($pic), 'public');
        

Please tell me where i am doing mistakes. Thanks

0 likes
3 replies
rsands's avatar

Did composer update have any issues when it was run? Does the file exist in vendor?

veve286's avatar

did u already register ServiceProvider in app.php in config folder ?

michaelvolst's avatar
Level 37

In the documention it says that you should require the v3 package

Amazon S3: league/flysystem-aws-s3-v3 ~1.0

Maybe this will help you

Please or to participate in this conversation.