S3 Bucket 给出 InvalidArgument (client): Unsupported value for canned acl 'private' - 用于使用 laravel 进行放置文件操作

aja*_*ana 3 php amazon-s3 amazon-web-services laravel

我正在使用 laravel 将图像上传到 s3 存储桶。删除操作和列出对象工作正常,但当我尝试上传图像时出现错误。无法解决问题。这是错误响应。

\n
Error executing "PutObject" on "https://weddingdotmelbourne.s3.us-west-002.backblazeb2.com/YoPDX.txt"; AWS HTTP error: Client error: `PUT https://weddingdotmelbourne.s3.us-west-002.backblazeb2.com/YoPDX.txt` resulted in a `400 Bad Request` response: \xe2\x97\x80\n<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Error>\n    <Code>InvalidArgument</Code>\n    <Message>Unsupporte (truncated...)\n InvalidArgument (client): Unsupported value for canned acl 'private' - <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Error>\n    <Code>InvalidArgument</Code>\n    <Message>Unsupported value for canned acl 'private'</Message>\n</Error>\n
Run Code Online (Sandbox Code Playgroud)\n

编辑\n这是我正在尝试的简单测试代码。

\n
Route::get('s3-putfile', function () {\n    try {\n        $name = Str::random(5) . ".txt";\n        $putFileAs = Storage::disk('s3')->put($name, "Hello this is the test file");\n        dd($putFileAs);\n    } catch (Exception $e) {\n        return ($e->getMessage());\n    }\n});\n
Run Code Online (Sandbox Code Playgroud)\n

Mor*_*tur 6

我在使用 Backblaze 时也发生过这种情况。您可以将 Laravel 配置为“公开”上传文件,当您的 Backblaze 存储桶设置为公开时,这是需要的。

config/filesystems.php

'disks' => [
  's3' => [
    ...
    'visibility' => 'public',
  ],
],
Run Code Online (Sandbox Code Playgroud)