...

View Full Version : opening docs/pdfs



quadrant6
09-13-2011, 02:27 AM
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.

Inigoesdr
09-13-2011, 02:29 AM
The best option is to use readfile() (http://php.net/readfile). Check the manual page example for the headers you need to send.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum