Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ajvanho's avatar
Level 14

I cant upload img-s to s3 anymore ?!?

I cant upload img-s to s3 anymorem, I have an error:

AccessControlListNotSupported (client): The bucket does not allow ACLs.

1 like
4 replies
LaryAI's avatar
Level 58

The error message suggests that the bucket you are trying to upload to does not support Access Control Lists (ACLs). You can try removing any references to ACLs in your code and see if that resolves the issue. Alternatively, you can create a new bucket that supports ACLs and upload your images to that bucket instead.

If you are using the AWS SDK for PHP, you can remove the ACL parameter from your S3Client::putObject() method call. For example:

$s3Client->putObject([
    'Bucket' => 'my-bucket',
    'Key' => 'my-image.jpg',
    'Body' => $imageData,
    'ContentType' => 'image/jpeg',
    // Remove the ACL parameter
]);

If you are using the Laravel Flysystem package, you can remove the 'visibility' parameter from your Storage::put() method call. For example:

Storage::disk('s3')->put('my-image.jpg', $imageData, [
    'ContentType' => 'image/jpeg',
    // Remove the visibility parameter
]);

If neither of these solutions work, you may need to contact AWS support for further assistance.

lifekent's avatar

The only thing that worked for us is to add next to the s3 config.

'options' => [
       'ACL' => ''
]

So then s3 config looks like:

's3' => [
       'driver' => 's3',
       'key' => env('AWS_ACCESS_KEY_ID'),
       'secret' => env('AWS_SECRET_ACCESS_KEY'),
       'region' => env('AWS_DEFAULT_REGION'),
       'bucket' => env('AWS_BUCKET'),
       'url' => env('AWS_URL'),
       'endpoint' => env('AWS_ENDPOINT'),
       'options' => [
           'ACL' => '',
       ],
],
1 like
shiroamada's avatar

@lifekent this should set as default in laravel filesystem s3 config section.

For newbie developer too much to understand S3 ACL is like a rabbit hole.

experimentor's avatar

@ajvanho When creating S3 bucket in AWS, it generally does not allow public visibility. There is a bucket public access setting which blocks all sorts of ways in which buckets / objects can be made public. You will have to manually override them to give public access to a bucket or its objects.

From the error you posted, I am assuming that you are trying to upload an image with public access. Maybe the server does not have the permission to set ACL on objects in the bucket.

Options:

  1. If all your images are public, override the bucket permissions and set all object in the buckets publicly readable. Then you can remove the part of the code in laravel - "storePublicly" i think.
  2. Set the permissions for the user / server role so that it can set the ACL on objects in the bucket. This may work. But your image might not be visible to the world.
  3. Most secure: use presigned urls to both upload and retrieve images.

Please or to participate in this conversation.