Re: Need Your Help :) I'm Just About Creating File Uploading Service

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

 



Nitsan Bin-Nun wrote:
Neh, we don't have plenty of these in Israel, don't count it in as an issue.

Serving the files won't be an overkill for my harddrive / cpu usage /
anything else?

There is a better way to serve the files with/without PHP and keeping them
outsite of the HTTP root?

If you want to use http the code I provided in my first response works very well for files I serve outside the web root.

make a dummy directory in the web root.
In that dummy directory put a single php file - called "dummy.php" or whatever.

Have that file check the users credentials etc. (IE via session id) - and have

$thispage=$_SERVER['REQUEST_URI'];

put a .htaccess file in the dummy directory containing:

RewriteEngine on
RewriteRule ^*\.iso$ dummy.php

That way a request to /dummy/something.iso

is handled by dummy.php - which then can figure out what file is wanted via the $thispage variable, verify the user has permission to download it via sessions etc. (and sends a 403 header if they don't), verifies that the file exists (and sends a 404 header if it doesn't), and then uses the code I outlined in my first post to grab the file from the real location that is outside the web root and sends it to the requesting client.

It works quite well for me.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux