cbassett03 Posted September 3, 2014 Share Posted September 3, 2014 How can I create a PHP script that will trigger a download? For example, if I have a database of files and file IDs, and have a hyperlink like this in an HTML page: getfile.php?FileID=1001 How can I code the getfile.php file so that no matter what type the file is (ZIP, EXE, JPG, AVI, etc), it will cause the browser to prompt the user to download the file? (Not entirely sure if this is more a PHP question or an HTML question because of how I'm approaching it...) (The purpose of me using the getfile.php file is so that files can be physically moved around without me having to update all of the hyperlinks in the HTML files, but rather just update the paths in the SQL database instead.) Link to comment https://forums.phpfreaks.com/topic/290816-php-code-to-trigger-file-download/ Share on other sites More sharing options...
trq Posted September 3, 2014 Share Posted September 3, 2014 This example should get you started: http://forums.phpfreaks.com/topic/11578-force-downloads/ Link to comment https://forums.phpfreaks.com/topic/290816-php-code-to-trigger-file-download/#findComment-1489719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.