1
Fork 0

Added simple page for auto downloading file

This commit is contained in:
Jake Howard 2015-06-22 11:11:33 +01:00
parent d88f025e3e
commit 3fe0f0cd94
1 changed files with 22 additions and 0 deletions

22
auto-download.php Normal file
View File

@ -0,0 +1,22 @@
<?php
require "property-manager.php"; // Initialise properties
require "file-information.php";
$properties = load_properties();
$file_name = $_GET[$properties["file QS"]] or die("No querystring given.");
if (file_exists($file_name)) {$GLOBALS["file"] = generate_file_object($file_name);}
else {die("File '$file_name' does not exist!");}
header("Content Type: text/html");
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $properties["auto title"] . " for " . $file["name"];?></title>
<link rel=stylesheet type=text/css href="style.css"/>
<?php yandex_meta($properties["yandex transparency"]) ?></head>
<body><center>
<h1>File Auto Downloader</h1><p>The file you requested will begin to download automatically. If it doesnt, click the link below.</p>
<?php echo "<a id='downloadButton' href='./downloads/" . $file["file name"] . "' download='" . $file["file name"] . "'>Click here to download file</a>";?>
</center><script>document.getElementById('downloadButton').click();</script>
</body>
</html>