download config

This commit is contained in:
Karl Hudgell 2016-02-07 18:47:45 +00:00
parent 18b5d0ff20
commit bdabb94448
2 changed files with 23 additions and 1 deletions

View File

@ -1,2 +1,2 @@
<a href="set1.php" target="main">General</a> - <a href="set2.php" target="main">SAB/Couch/Sick</a> - <a href="set3.php" target="main">Others</a> - <a href="set4.php" target="main">Drive Space</a> - <a href="set5.php" target="main">RSS/Server Statuses</a> - <a href="PicUpload.html" target="main">Picture Upload</a> - <a href="/../ManUpdate.php" target="main">Manual Update</a>
<a href="set1.php" target="main">General</a> - <a href="set2.php" target="main">SAB/Couch/Sick</a> - <a href="set3.php" target="main">Others</a> - <a href="set4.php" target="main">Drive Space</a> - <a href="set5.php" target="main">RSS/Server Statuses</a> - <a href="PicUpload.html" target="main">Picture Upload</a> - <a href="/../ManUpdate.php" target="main">Manual Update</a> - <a href="/../download.php" target="main">Download Config File</a>

22
download.php Normal file
View File

@ -0,0 +1,22 @@
<?php
// Fetch the file info.
$filePath = 'config.php';
if(file_exists($filePath)) {
$fileName = basename($filePath);
$fileSize = filesize($filePath);
// Output headers.
header("Cache-Control: private");
header("Content-Type: application/stream");
header("Content-Length: ".$fileSize);
header("Content-Disposition: attachment; filename=".$fileName);
// Output file.
readfile ($filePath);
exit();
}
else {
die('The provided file path is not valid.');
}
?>