force download file from s3 using php

I want to download the file directly from s3 to user machine. So I have googled and came up with something like this. But this is not working.

$objInfo = $s3->getObjectInfo('bucket', 'filename.mp3');
$obj = $s3->getObject('bucket', 'filename.mp3');

header('Content-type: ' . $objInfo['type']);
echo $obj->body;

Please help me on this. How to force download file not based on URL from s3.

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories