Skip to content Skip to sidebar Skip to footer

Uploading Images To S3 With Meta = Image/jpeg - Python/boto3

How do I go about setting ContentType on images that I upload to AWS S3 using boto3 to content-type:image/jpeg? Currently, I upload images to S3 using buto3/python 2.7 using the fo

Solution 1:

Add it in the ExtraArgs argument:

s3.upload_fileobj(bytes_io_file, bucket_name, filename, ExtraArgs={ "ContentType": "image/jpeg"})

Post a Comment for "Uploading Images To S3 With Meta = Image/jpeg - Python/boto3"