Member-only story
Laravel 12 How to Upload Files to Amazon S3 And Local Server
3 min readMar 30, 2025
Install Laravel 12 & Follow this Link
Install Amazon S3 Composer Package
Before using the S3 driver, you will need to install the Flysystem S3 package via the Composer package manager:
composer require league/flysystem-aws-s3-v3 "^3.0" --with-all-dependencies
Configure AWS S3 Credentials
An S3 disk configuration array is located in your config/filesystems.php
configuration file. Typically, you should configure your S3 information and credentials using the following environment variables which are referenced by the config/filesystems.php
configuration file:
AWS_ACCESS_KEY_ID=<your-key-id>
AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=<your-bucket-name>
AWS_USE_PATH_STYLE_ENDPOINT=falsecomposer require league/flysystem-aws-s3-v3 "^3.0" --with-all-dependencies
Create ImageUploadController
php artisan make:controller ImageUploadController
app/Http/Controllers/ImageUploadController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use…