How to protect PDF files from being downloaded or copied

后端 未结 4 1386
无人共我
无人共我 2021-01-23 12:46

I\'m developing a new website with PHP & MySQL.

The website is for an online eBook library that grant access to its books based on paid subscription plans.

S

4条回答
  •  迷失自我
    2021-01-23 13:11

    You'll be able lock down the files from unwanted downloads. But redistribution or sharing login details will be a battle.

    Some options I can think of

    Option 1: You can handle this yourself on the server. Housing the PDFs outside of the public Apache directory (so there is no way a URL can reach it). Then with a PHP function read the contents of the file and stream it to the browser. Streaming a large file using PHP

    Option 2: Use something like AWS S3. You can lock down the bucket so there is no public access. And generate signed URLs as needed. They'll be unique urls which you can specify a time limit of availablity. AWS S3 The security of a signed URL as a hyperlink

提交回复
热议问题