【问题标题】:S3 Bucket gives InvalidArgument (client): Unsupported value for canned acl 'private' - for put file operation with laravelS3 Bucket 提供 InvalidArgument (client): Unsupported value for canned acl 'private' - for put file operation with laravel
【发布时间】:2021-09-30 16:33:50
【问题描述】:

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

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: ◀
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Error>
    <Code>InvalidArgument</Code>
    <Message>Unsupporte (truncated...)
 InvalidArgument (client): Unsupported value for canned acl 'private' - <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Error>
    <Code>InvalidArgument</Code>
    <Message>Unsupported value for canned acl 'private'</Message>
</Error>

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

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

【问题讨论】:

  • 您能提供执行上传/PUT 的代码吗?
  • 嘿@Jordan,请检查我编辑代码的问题。

标签: php laravel amazon-web-services amazon-s3


【解决方案1】:

我对 Backblaze 也有同样的问题。正如您在他们的文档中看到的那样,您不能在单个项目级别上设置“公共”或“私人”类型。 在您的情况下,“文件夹”是公共的,Laravel 尝试将文件写入“私有”,这会导致错误。

我已经解决了将整个 Bucket 设置为私有的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-23
    • 2015-02-21
    • 1970-01-01
    • 2018-04-15
    • 2014-01-20
    • 2022-12-19
    • 2020-06-05
    • 1970-01-01
    相关资源
    最近更新 更多