News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Kae Verens' Blog:
Serving files through a script
January 14, 2009 @ 09:37:55

Kae Verens has posted a quick tutorial about serving up files by routing them through a "fetch" script, pulling their contents in one side and back out the other.

One thing I need to do while building the multi-user version of webme is to convert it so file references such as /f/photos/an_image.jpg get transparently converted so they serve correctly, even though the actual file may be located somewhere entirely else.

There's two steps involved - rewriting the URL request for the types of files you'd like to pull through the script (using some mod_rewrite magic in Apache) and make the script to do the actual work. Source for that is included too. Not only can something like this help you keep things organized but it also allows for extra security if you need to store the files outside of the webserver's document root.

0 comments voice your opinion now!
serve file script modrewrite output buffer readfile


blog comments powered by Disqus

Similar Posts

AnyExample.com: Downloading files from Amazon S3

Jim Plush\'s Blog: MyBic AJAX 0.3 released with EASY FORMS & Debug!

Rob Allen's Blog: Zend Framework Tutorial Zip File Updated

The Shadow Fox Network: Create Dynamic URLs With Mod_Rewrite and PHP Functions

Jim Plush\'s Blog: Holy Shit Batman - Sites popping up to decode Zend encoded files!


Community Events





Don't see your event here?
Let us know!


conference series introduction list symfony composer laravel community language framework version unittest interview podcast voicesoftheelephpant configure threedevsandamaybe release api opinion

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework