How do you initiate/force a download for files that reside externally in PHP or other language?

后端 未结 6 575
你的背包
你的背包 2021-01-25 12:54

If you have images or other files that reside externally, how do force the browser to download the link when a user click on it?

The use of \"Content-disposition: attac

6条回答
  •  野性不改
    2021-01-25 13:24

    I use a combination of the aforementioned "Content-Disposition" header, as well as forcing the type:

    header("Content-type: attachment/octet-stream");
    header('Content-disposition: attachment; filename="'.$filename.'"');
    

提交回复
热议问题