gpt4 book ai didi

php - S3 Bucket 给出 InvalidArgument(客户端): Unsupported value for canned acl 'private' - for put file operation with laravel

转载 作者:行者123 更新时间:2023-12-05 09:31:57 26 4
gpt4 key购买 nike

我正在使用 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());
}
});

最佳答案

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

config/filesystems.php 中:

'disks' => [
's3' => [
...
'visibility' => 'public',
],
],

关于php - S3 Bucket 给出 InvalidArgument(客户端): Unsupported value for canned acl 'private' - for put file operation with laravel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68501024/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com