using POST data for a readfile

From: Date: Mon, 11 Apr 2005 09:59:34 +0000
Subject: using POST data for a readfile
Groups: php.db 
Request: Send a blank email to php-db+get-39167@lists.php.net to get a copy of this message
Hi list, (mail problem you may get that one twice!) My problem: I protect my files by storing them out of the web root or behind a htaccess. As I'm not using the htaccess authentication for my users, I use a readfile to serve the file, basically something like: <a href='callFile.php?id=test.pdf'>File to serve</a> and in the script callFile something like readfile(./protectedDir/test.pdf). this works fine, but I just would like to use a post instead of a get, to avoid my users trying to modify the url. I tried to use a function in the callFile script, something like: function getFile ($fileId) { readfile($fileId); } if (isset($_POST['fileId'])) { $fileId=$_POST['fileId']; getFile($fileId); } but it doesn't work. I also tried to do a require_once (callFile.php) and then later on call the getFile function from the first script but no more success. Does anybody has any idea on how to do that? Thanks, Melanie _________________________________________________________________ Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/

« previous php.db (#39167) next »