Limited Period Offer : 20% Discount on online/offline courses, for more details call/whatsapp

How to use and upload profile photos to AWS s3 using laravel jetstream

0 min read
1 year ago By Santosh Kshirsagar

As mentioned in official documentation https://jetstream.laravel.com/3.x/features/profile-management.html#enabling-profile-photos enable profile photos in config/jetstream.php by removing comment for Features::profilePhotos()

In .env file add aws credentials also make sure to follow laravel documentation to use aws s3 driver

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET= 
AWS_USE_PATH_STYLE_ENDPOINT=false

add one more variable in .env

VAPOR_ARTIFACT_NAME=true

You can change filesystem disk to s3 if needed for default save

FILESYSTEM_DISK=s3

You have to make sure add cors configuration on aws s3 bucket if you get this error - CORS header 'Access-Control-Allow-Origin' is missing.

go to s3 > select bucket > permission > cors configuration edit

in below example change to your local url if want and change with your website url

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "http://127.0.0.1:8000"
        ],
        "ExposeHeaders": []
    },
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "https://yourwebsitename.com"
        ],
        "ExposeHeaders": []
    },
    {
        "AllowedHeaders": [],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]
Jun 20, 2023 19:35 Back to Articles

Other Articles

How to identify Stack Questions? How to identify Stack Questions?

In this article, you will get clarity about how to find any given question that can be solved using stack.

1 year ago By Aniket Prajapati
Top 10 Web Frameworks of 2023 Top 10 Web Frameworks of 2023

As technology evolves and new trends arise, the landscape of web frameworks is continually shifting. This article will present the top 10 web frameworks to consider in 2023.

1 year ago By Mitali Gupta
Merge Two Sorted Linked List

Merge Two Sorted Linked List is a Standard Linked list Problem which is Frequently asked in Many Coding interviews. The basic idea is you have given Two Sorted Linked list which are sorted in its own and you have to return return a pointer node which has a merge single list of both the sorted list .

1 year ago By Aniket Prajapati
Establishing Validation by Converting TypeScript Code to Zod Schemas Establishing Validation by Converting TypeScript Code to Zod Schemas

In this article, we'll explore how to establish validation by converting TypeScript code to Zod schemas. Zod is a TypeScript-first schema validation library that ensures data validity at runtime.

1 year ago By Mitali Gupta