|
|
Question : php apache authenticate user's request for files
|
|
What I want to do is have a online "locker" for users to store their files and get them from anywhere. Not that original. I want to authenticate all requests for these files though. The files will be doc, xls, ppt, ect. So basically I need the most efficient way to intercept all requests for files in a certain directory, check if that user has permissions to view the file via a php script, and then if they do, give them the file. If they do not, forward them to a login/error page. I was able to do with before by having the php script intercept all file requests via mod_rewrite, and then to serve the file to the user. To do this I had to open the file in php and then write it back out to the user. This was slow, and I think there is a more efficient way.
|
Answer : php apache authenticate user's request for files
|
|
If you're not doing it in PHP, then you're serving it through HTTP. Serving it through HTTP will necessarily expose the filename. The PHP options all work on reading/rewriting.
You could have the user forwarded to a PHP script that copies the file to a temporary filename, then further redirect the user to the direct download. The problem is that the filename will be different from what they requested (some tricky accounting can take care of that), and you'll have to detect when the file is finished, or delete it after a set time limit.
|
|
|
|
|