Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to download file from s3 bucket using php

Got it to work by echo'ing out the content-type header before echo'ing the $object body.

$objInfo = $s3->get_object_headers('my_bucket', 'test.jpg');
$obj = $s3->get_object('my_bucket', 'test.jpg');

header('Content-type: ' . $objInfo->header['_info']['content_type']);
echo $obj->body;
 
PREVIOUS NEXT
Tagged: #download #file #bucket #php
ADD COMMENT
Topic
Name
2+1 =