Hi,
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:
HTML Code:
<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>
Your success page would look like this:
PHP Code:
<?php
if(isset($_GET['file_name'])){
$download_path = '/downloads/' . $_GET['file_name'];
} else {
die("Please don't load this page directly!");
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="refresh" content="5;url=<?php echo $download_path ?>"/>
<title>Success!</title>
</head>
<body>
<h1>Your download will begin shortly!</h1>
<p>If it doesn't begin, <a href="<?php echo $download_path ?>">click here</a></p>
</body>
</html>
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.
PHP Code:
<?php
if(isset($_GET['file_name'])){
if (preg_match('/file_\d.exe/', $_GET['file_name'])){
$download_path = '/downloads/' . $_GET['file_name'];
} else {
die("Invalid filename!");
}
} else {
die("Please don't load this page directly!");
}
?>
Hope that helps.
Bookmarks