aws/aws-sdk-php-laravel

Found 1 error while validating the input provided for the PutObject operation in S3 PHP SDK to upload docs.

BhanuRajpoot opened this issue · 3 comments

I have to use S3 PHP SDK to upload docs in AWS S3 bucket, but i am getting an error:

Found 1 error while validating the input provided for the PutObject operation:
[Body] must be an fopen resource, a GuzzleHttp\Stream\StreamInterface object, or something that can be cast to a string. Found bool(false)

$result = $s3Object->putObject([
'Bucket' => $bucketName,
'Key' => $objectKey,
'Body' => fopen($files->file, 'r'),
'Tagging' => $tagingData,
'ACL' => 'public-read'
]);

@BhanuRajpoot fopen returns false on error... it's likely your file doesn't exist or you don't have permissions to read the file.

Thanks @matthewnessworthy , i will check again.

Check the keys, the first letter must be capital.