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

时间:2022-04-02 23:02:47

Let's say I have the s3 url path of my file location. how can i directly download the file from that path to downloads folder on a click of a button?

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

1 个解决方案

#1


1  

Try this one:

试试这个:

<?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 );
}
?>

#1


1  

Try this one:

试试这个:

<?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 );
}
?>