Using php to force download a pdf

后端 未结 5 1525
渐次进展
渐次进展 2020-12-17 21:25

Im trying to get a website to have a button that forces a download of a pdf.

Heres the html of the button:

    
           


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 21:46

    By the way, a bit late, but to identify the problem properly here:

    Your download script is at scripts/download.php and the file you want to download is at documents/[...].pdf.

    Therefore, your readfile() function should be traversing to the parent directory (outside of scripts/), e.g. readfile('../documents/[...].pdf');.

提交回复
热议问题