There is a easier way, I use this all the time and I don't have a problem with it. Sometime the header() need some tweaking to make it work right. You must include an exit() function after the header() due to bugs and bugs in IE. This script below is what I use for file download. Instead of file download, you can easily tweak the header to any of other things like display PDF without knowing where hte real file is...
--snip-- "HTML Link" echo "<a href='$PHP_SELF?dw_code=0'>\n"; --snip-- --snip-- "PHP Script" //Script for File Download... (DP, Temp, etc...) //(1st --> Original File (File on Server)... //(2nd --> Renamed File & Fake File Path (Browser Download)... //(3rd --> Hyperlink (Display Comment)... $DownloadUpdateArray[0] = array('update\setup.exe','setup.exe','Special Feature Update 1.0'); if (strlen(trim($_REQUEST['dw_code']))!=0) { //Send Downloadable File(s) To Browsers... $file=$DownloadUpdateArray[$_REQUEST['dw_code']][0]; header ("Pragma: public"); header ("Expires: 0"); // set expiration time header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header ("Content-Type: application/force-download"); header ("Content-Type: application/octet-stream"); header ("Content-Type: application/download"); header ("Content-Disposition: attachment; filename=\"".$DownloadUpdateArray[$_REQUEST['dw_code']][1]."\";"); header ("Content-Length: ".filesize($file)); header ("Content-Transfer-Encoding: binary"); //Can't use readfile() due to poor controling of the file download. //(IE have this problems)... //readfile($file); //use fopen() instead of readfile... $fp = fopen($file, 'rb'); $content = fread ($fp, filesize($file)); fclose ($fp); print $content; } //Required, to keep IE from running into problems //when opening the file while downloading or downloading... //(IE been acting strange lately...) exit(); } --snip-- "Kae Verens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ciprian Trofin wrote: > > Hi All, > > > > I want to give access to resources (PDFs and some RTFs) only to registered > > users and I also want to deny that kind of access to people that "guess" > > the URL. I guess it is all about putting these files outside the web-tree > > and somehow putting PHP to work. > > > > Could you enlighten me ? :)) > > > > http://php.net/fpassthru is the answer to the web-tree problem. > > The authentication is a different matter. I have my own method - I'm > sure others have other/better methods. > > Kae > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php