We upload contents to S3 private bucket. After uploading contents we access them through presigned url. MP4, images are working fine when we access that url through the browser. But when we try to access SWFs and PDFs, browser prompts to download content. And also it won't happen when we try to access assets from public bucket.
Is it default behavior or is there any solution for that?
I check this doc
code to get url
public function getPresignedUrl($filename, $expires,$bucket=NULL)
{
if($bucket==NULL){
$bucket=$this->bucket;
}
$command = $this->getClient()->getCommand('GetObject', ['Bucket' =>$bucket , 'Key' => $filename]);
$request = $this->getClient()->createPresignedRequest($command, $expires);
return (string) $request->getUri();
}
=============================Update 1=================================
We are using 'upload' function of AWS sdk to upload swfs, pdfs and also mp4s.
public function upload($filename, $source, $acl = null, array $options = [])
{
if($this->getClient()->upload(
$this->bucket,
$filename,
$source,
!empty($acl) ? $acl : $this->defaultAcl,
$options
)){
return true;
}else{
return false;
}
}
Thanks