Inital
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// Überprüfen, ob der Benutzer angemeldet ist und die Kennung "admin" hat
|
||||
if (!isset($_SESSION['user']) || $_SESSION['user'] !== 'admin') {
|
||||
die("Unbefugter Zugriff.");
|
||||
}
|
||||
|
||||
$pdf_path = "./../datenupload/DHL-Paketmarke_PAKW6CYN3TC9_René_Lehradt_.pdf";
|
||||
if ($pdf_path) {
|
||||
if (file_exists($pdf_path)) {
|
||||
// Erzeugen eines temporären Dateinamens
|
||||
$temp_pdf_path = tempnam(sys_get_temp_dir(), 'pdf_');
|
||||
// Kopieren der PDF-Datei in den temporären Ordner
|
||||
copy($pdf_path, $temp_pdf_path);
|
||||
|
||||
// Setzen der Header für den Download
|
||||
header('Content-Type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="' . basename($pdf_path) . '"');
|
||||
header('Content-Length: ' . filesize($temp_pdf_path));
|
||||
|
||||
// Ausgabe des Inhalts der temporären Datei
|
||||
readfile($pdf_path);
|
||||
|
||||
// Löschen der temporären Datei
|
||||
unlink($temp_pdf_path);
|
||||
exit;
|
||||
} else {
|
||||
echo "Die Datei existiert nicht.";
|
||||
}
|
||||
} else {
|
||||
echo "Keine PDF-Datei gefunden.";
|
||||
}
|
||||
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
Reference in New Issue
Block a user