-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 putObject does not set Content-Type #1203
Comments
I noticed this few weeks ago. Here is my code: use Symfony\Component\Mime\MimeTypes;
$mimeType = new MimeTypes();
$responses[] = $this->s3Client->putObject([
'Bucket' => $this->bucket,
'Key' => $file->getRelativePathname()
'Body' => fopen($file->getRealPath(), 'rb'),
'ACL' => 'public-read',
'CacheControl' => 'max-age=31536000',
'ContentType' => $mimeType->getMimeTypes($file->getExtension())[0] ?? $mimeType->guessMimeType($file->getRealPath()) ?? 'application/octet-stream',
]); note: I also noticed that AWS has a bug when uploading the object in multiparts (big objects). In such situations, AWS automatically adds empty ContentEncoding attributes, which breaks clients (like chrome/firefox browsers). |
In contrast to the official AWS SDK Async AWS does not set content type when uploading files to S3, is this by design?
The text was updated successfully, but these errors were encountered: