dzuritaa's avatar

Error uploading a file to ASW S3 with L5

Hello, I'm learning how to upload a file to S3 of AWS, and I was following along the video "Multiple Filesystems", so I have my class that is calling the Filesystem

use Illuminate\Contracts\Filesystem\Filesystem;

with the function

public function index(Filesystem $filesystem){
        $filesystem->put('hello.txt');
        return 'I work!';
}

and I'm specifying the driver in the filesystem to s3 with the key, the secret the region 'US Standard' and the bucket, also the bucket has the permitions to "Everyone" justo to view permisions, and "Authenticated Users" to upload/delete. Also I'm using the repositori aws/awssdkphp 2.7 installed with composer. But when I run the code I get this error

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

And I hvae no idea what to do. I hope you guys can give me a hand. Thanks.

0 likes
2 replies
usman's avatar
usman
Best Answer
Level 27

@dzuritaa you need to install the flysystem s3 driver:

composer require league/flysystem-aws-s3-v2
2 likes
dzuritaa's avatar

Thanks, that worked.. but I'm getting another error, and I'm not sure if I should ask another question, but anyway here's the error

TransferException in AbstractClient.php line 258: [curl] 6: Could not resolve host: techkum-imagenes.s3.Oregon.amazonaws.com [url] https://techkum-imagenes.s3.Oregon.amazonaws.com/hello.txt

I cheked the names of the bucket and the region and they are correct.

Hope you can help me with this. Thanks

Please or to participate in this conversation.