What are the options of having a pdf that requires a user to be logged in before they can access the link. I want to restrict access of the URL be sent to un registered users.
I’ve seen fileDownloadPE which looks like a great option, but wondered if there were other ways of doing this with out having to set up a resouce for each pdf.
Thanks
Ben
-
☆ A M B ☆
- 2,475 Posts
This can be tricky... the best solution for this prob. requires that you store your pdf’s ABOVE the web directory or possibly in the database. Usually this type of thing requires that you validate (e.g. against whether or not you’re logged in and have access), then PHP will stream the file by printing the correct headers and then printing the file contents. You need to be aware of large files though... PHP can hit memory limits on large downloads.
I’m not sure what other solutions there are out there, but this is a fairly common request... as long as the file itself is outside of the document root and it HAS to be accessed via code, then you’re pretty safe if you put that code in a place that requires a user to be logged in.