moh_abk's avatar

S3 upload of images and files - Lumen

Can anyone please point me to the direction of a post or advice on how to upload files/images to AWS S3 in Lumen.

Do I need to copy filesystems.php from laravel? Do I need to install any league/flysystem-aws-s3-v3 ~1.0?

Thanks

0 likes
1 reply
mslabba's avatar

Yes, you need to install league/flysystem-aws-s3-v3 ~1.0

Configure your .env

public function uploadFileToS3(Request $request) { $image = $request->file('image'); $imageFileName = time() . '.' . $image->getClientOriginalExtension(); $s3 = Storage::disk('s3'); $filePath = '/venue/' . $imageFileName; $s3->put($filePath, file_get_contents($image)); }

Please or to participate in this conversation.