Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    opening docs/pdfs

    Because I need to login protect some files, I'm using a PHP script to check login and then load the file.

    My question is how should I load the file?

    i.e. the user requested exam.pdf. Behind the scenes (with rewrites) I load view_file.php

    Should view_file using fopen or similar to load the file?

    It will mostly be pdf and word files but could be other so I'll probably have to check the extension.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    The best option is to use readfile(). Check the manual page example for the headers you need to send.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •