copystart Posted May 15, 2007 Share Posted May 15, 2007 Hello. Im trying to make a simple PHP file which will return a file for download. For example: www.gwa.com/file.php?ilovechicken.mp3 . This would then in turn return that mp3 and the php file would know the directory and full url where to find the mp3 at and so on. I am making this so I can track file download counts, but so files such as mp3's can still be played through Podcast RSS Feed players. Im not exactly sure how to get the argument or file name and how to then force download the file once called apon that link from an mp3 player or even normal web client. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/51422-php-file-download/ Share on other sites More sharing options...
chronister Posted May 15, 2007 Share Posted May 15, 2007 www.gwa.com/file.php?file_name=ilovechicken.mp3 <?php $file=$_GET['file_name']; // insert whatever data you want into database or into a file based database. header('/path/to/'.$file); ?> It's crude, but it is the general principle. If you need further help, get some code together and post back. Hope This Helps, Nate Quote Link to comment https://forums.phpfreaks.com/topic/51422-php-file-download/#findComment-253264 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.