View Full Version : Download through a PHP script

07-08-2005, 01:09 PM
How to make download of a file from a PHP script?
Generally, I can download files using 'download accelerator' as I know url of the file e.g., ~/archive.tar.tz

But sometimes ( raretimes ), I can't do that e.g., OSoft Web site.

Actually, we're making audios and videos available only to a valid user. If that files reside in filesystem, then, what are the tricks to pervent them from people, and only available to desired people through a PHP script?

07-08-2005, 01:53 PM
You might be able to do it with a .htaccess file to restrict access, I'm not sure, but personally I've found it simple and effective to server the files either from outside the root of the website or to store them in a database and just retrieve and server them that way (after first checking the user is logged in and authorised to view the file, of course).