【发布时间】: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