cbassett03 Posted September 3, 2014 Share Posted September 3, 2014 (edited) 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.) Edited September 3, 2014 by cbassett03 Quote Link to comment 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/ 1 Quote Link to comment 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.