amazon aws s3에서 다음 코드를 시도하고 있습니다. (v3 php sdk를 사용하고 있습니다)
$bucketName = 'somebucketName';
$key = 'folderName';
$params = [
'Bucket' => $bucketName,
'Key' => $key . '/'
];
$s3->putObject($params);
$ s3은 $s3 = new Aws\S3\S3Client
클래스의 인스턴스이며 현재 구성으로 버킷과 객체를 성공적으로 얻습니다.
이전에는 잘 작동했지만 지금은 오류가 발생합니다.
치명적 오류 : " https://s3-us-west-2.amazonaws.com/sdfsdf/demoer/ " 에서 'Error running "PutObject"메시지와 함께 포착되지 않은 예외'Aws \ S3 \ Exception \ S3Exception ' ;
AWS HTTP 오류 : 클라이언트 오류 : 411 MissingContentLength (클라이언트) : Content-Length HTTP 헤더를 제공해야합니다.
이 오류는 넣을 이미지 또는 개체를 전달하지 않기 때문입니다. 객체도 전달하십시오. 나는 또한 비슷한 종류의 문제에 직면했다 https://stackoverflow.com/questions/32117596/aws-s3-uploaded-images-are-getting-corrupted 아래 코드를 확인하십시오.
try {
$result = $s3->putObject(array(
'Bucket' => $bucketName,
'Key' => $key . '/',
'SourceFile' => $filepath, // file path which is putting on AWS S3, Path should be absolute path like $filepath = "/var/www/html/for_testing_aws/assets/img/avtar.png";
'ContentType' => mime_content_type($filepath),
));
} catch (S3Exception $e) {
echo $e->getMessage() . "\n";
}
자세한 내용은 AWS putObject
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다