我正在尝试使用AWS PHP SDK上传图像。出于某些奇怪的原因,有些图片没有上传?
$s3 = new Aws\S3\S3Client([
'region' => 'us-east-1',
'version' => 'latest',
'endpoint' => 'https://example.com',
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $access_key,
'secret' => $secret,
]
]);
try {
$result = $s3->putObject([
'Bucket' => $bucket,
'Key' => $file_name,
'Body' => fopen($file_location, 'r'),
'ContentType' => $imageType,
'ACL' => 'public-read'
]);
} catch(Aws\S3\Exception\S3Exception $e) {
echo $e->getMessage();
}
我可以从dummyimage.com下载图像,它将成功上传到存储桶,但是当我尝试其他图像时,s3返回500内部服务器错误。
我该如何解决?错误日志中没有任何内容。