Upload image to AWS s3 storage from Laravel showed Heroku Server 500 Error

I've added

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
AWS_BUCKET

in Heroku and the according value to Heroku Config Vars.

Then, I uploaded image to '/images' folder on s3.

$path = $request->file('image')->store('/images', 's3');

After that, Heroku server showed the following error:

server error 500 title server error 500 specific

Is there anyone can help me explain what's going on? Thanks a lots. I'm trying figure out...

UPDATE:

Here is my create.blade.php

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
        integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
</head>

<body>
    <form action="/" method="POST" enctype="multipart/form-data">
        @csrf
        <input type="file" name="image" id="image">
        <button type="submit">Upload File</button>
    </form>
</body>

</html>


Read more here: https://stackoverflow.com/questions/64951672/upload-image-to-aws-s3-storage-from-laravel-showed-heroku-server-500-error

Content Attribution

This content was originally published by Reggie at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: