Thanks a lot for your help.
I have the following code, but get a ERROR 500.
<?php
$conn = new mysqli("****.de", "***********", "********", "***********");
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
$stmt = $conn->prepare("SELECT DateiPfad, Dateiname FROM ****** WHERE DokumentId = ?");
$stmt->bind_param($_POST["dokid"]);
$stmt->execute();
$res = $stmt->get_result();
$row = $res->fetch_assoc();
$stmt->close();
$file = ('/usr/home/vewade' . $row['DateiPfad'] . '/' . $row['Dateiname']);
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
} else {
header("HTTP/1.0 404 Not Found");
}
?>
Any idea, what is missing?