We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36926
    • 701 Posts
    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
      • 9207 ☆ 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.
        • 36926
        • 701 Posts
        Quote from: Everett at May 01, 2010, 01:55 AM

        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.

        Thanks for the reply Everett, think i get what your saying. I’ll have a play around. Thanks again.

        Ben