I’m looking forward to create a download button that allows users to download .exe(setup) file from my website and after that and it redirects them to another page. For example, check out the download button of this site:
The site you link to first redirects you to the “after” page (with a “Click here if your download doesn’t start” notice) , then it initiates the download.
As far as I know, this is really the only way to do what you ask (reliably).
Linking to the after page is simple:
<a href="download.html">Click here to download your file</a>
Starting the download can then be done using a meta refresh, which is supported in most browsers:
If you are dealing with multiple downloads, you will ideally need to write your “Success” page in PHP or some such similar language.
All of the links on your download page would point to this “Success” page and would pass in the file they want to download as a parameter.
Your links on the download page would look like this:
<a href="success.php?file_name=file_1.exe">Click here to download file 1</a>
<a href="success.php?file_name=file_2.exe">Click here to download file 2</a>
<a href="success.php?file_name=file_3.exe">Click here to download file 3</a>
This is a simple example to demonstrate the concept.
In real life you will want to be very restrictive as to what you accept in this $_GET['file_name'], as you don’t want people downloading random files off of your server.
In your case, you only seem to be offering eight files as downloads, so you could even check for each of these individually.
You’ll probably be reasonably safe with the example given by Pullo, but something to keep in mind when coding this sort of downloader functionality with more general paths is the dreaded Directory Traversal Attack - this is where an attacker passes in a bunch of ‘…/…/…/’ that gives them free license to download any path your server has access to.