I have searched high and low for how to add a simple ContentType metadata to a MultiPartUploader in AWS PHP SDK. The docs specifically mention how to do it for PutObject, but have no mention of how to do it with a MultiPartUploader.
I have tried every method I could find online, but nothing is working and my file is always getting set to application/octet-stream.
Does anyone have any experience with this? Here is my code:
$uploader = new MultipartUploader($this->s3, $local_path, [
'bucket' => env('AWS_BUCKET'),
'key' => $path .'/'. $filename,
'contentType' => 'video/mp4', // have tried this
'metaData' => [ // have tried this (all well as all variations of caps)
'contentType' => 'video/mp4',
]
]);
do
{
try
{
$result = $uploader->upload();
}
catch (MultipartUploadException $e)
{
$uploader = new MultipartUploader($this->s3, $local_path, [
'state' => $e->getState(),
]);
}
}
while (!isset($result));
After reading through the MultiPartUploader class, it looks like the ContentType should be automatically set, but it is not being set.
I am using v3 of the SDK
Any advice would be greatly appreciated!