如何在单击按钮时直接从s3路径下载文件?

时间:2017-02-21 09:17:11

标签: php amazon-s3 yii2

我们说我的文件位置有s3 url路径。如何通过点击按钮直接将文件从该路径下载到下载文件夹?

1 个答案:

答案 0 :(得分:1)

试试这个:

<?php 
if(isset($_POST('btnDownload')))
{
  $fileurl = 'your full path of s3 here';
  header("Content-type:application/pdf");
  header('Content-Disposition: attachment; filename=' . $filename);
  readfile( $fileurl );
}
?>
相关问题