Add datetimestamp to downloaded filename (e.g. "pi-hole-teleporter_2017-03-05_01-37-52.zip")

This commit is contained in:
DL6ER
2017-03-05 13:38:06 +01:00
parent 236d16cfd0
commit e695f490c0

View File

@@ -127,7 +127,8 @@ if($_POST["action"] == "in")
}
else
{
$archive_file_name = "/var/www/html/pi-hole-teleporter_".microtime(true).".zip";
$filename = "pi-hole-teleporter_".date("Y-m-d_h-i-s").".zip";
$archive_file_name = "/var/www/html/".$filename;
$zip = new ZipArchive();
touch($archive_file_name);
$res = $zip->open($archive_file_name, ZipArchive::CREATE | ZipArchive::OVERWRITE);
@@ -146,7 +147,7 @@ else
header("Content-type: application/zip");
header('Content-Transfer-Encoding: binary');
header("Content-Disposition: attachment; filename=pi-hole-teleporter.zip");
header("Content-Disposition: attachment; filename=".$filename);
header("Content-length: " . filesize($archive_file_name));
header("Pragma: no-cache");
header("Expires: 0");