louis_coetzee Posted April 17, 2009 Share Posted April 17, 2009 Hi all, I am creating a website for a client, selling a document online thedocument.zip I need a script to trigger the download of a file, which i will protect in a folder with .htaccess. The plan is that the person can only download the file 3 times. so eatch time I am increasing the counter in the db, this I will do myself, but when the person enterst the right ticketcode, the download must start otherwise, nothing. Have been googling, don't know what to look for. thanks. Link to comment https://forums.phpfreaks.com/topic/154474-solved-php-download-trigger/ Share on other sites More sharing options...
jackpf Posted April 17, 2009 Share Posted April 17, 2009 You'll need to send the right header()s to force the download, with the correct mime type. Here's a good tutorial - http://php.dzone.com/news/php-force-download-keep-whats- Link to comment https://forums.phpfreaks.com/topic/154474-solved-php-download-trigger/#findComment-812195 Share on other sites More sharing options...
mentalist Posted April 17, 2009 Share Posted April 17, 2009 to make it safer you could store the file in your database, then read as required and print it in place of the file read function in the example jackpf gave. Link to comment https://forums.phpfreaks.com/topic/154474-solved-php-download-trigger/#findComment-812208 Share on other sites More sharing options...
louis_coetzee Posted April 17, 2009 Author Share Posted April 17, 2009 Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/154474-solved-php-download-trigger/#findComment-812212 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.