using POST data for a readfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux