How do I store product images on S3

You need to configure and set up your Laravel project for the S3 storage driver. You can read more about this in the laravel documentation. This involves setting your S3 credentials in your env file (you usually need to add values for AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, and AWS_BUCKET) and installing a composer package (league/flysystem-aws-s3-v3 ~1.0) that lets Laravel support S3.

Once your project is configured you should set STORE_FILE_DRIVER and STORE_LOCAL_FILE_DRIVER to your S3 driver. If you have followed the Laravel documentation steps above and are using the default S3 disk already created you will simply add this to your env file:

STORE_FILE_DRIVER=s3
STORE_LOCAL_FILE_DRIVER=s3

STORE_FILE_DRIVER
This by default is set as public and is the disk used by Aero when uploading files that should be publicly accessible.

STORE_LOCAL_FILE_DRIVER
This by default is set as local and is the disk used by Aero when uploading files that should not be publicly accessible directly.

Articles in this section

Was this article helpful?
0 out of 0 found this helpful