$tripId, 'name' => $name, 'dateiname' => $filename, 'mime_type' => $mime, 'groesse' => $file['size'], 'created_by' => $user['id']]); } } } header('Location: /Develop/PlanerGoogel/dokumente.php?trip=' . $tripId); exit; } // Löschen if ($canEdit && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete'])) { $doc = dbOne('SELECT * FROM dokumente WHERE id = ? AND trip_id = ?', [(int)$_POST['delete'], $tripId]); if ($doc) { @unlink($uploadDir . $doc['dateiname']); dbExec('DELETE FROM dokumente WHERE id = ?', [$doc['id']]); } header('Location: /Develop/PlanerGoogel/dokumente.php?trip=' . $tripId); exit; } // Download if (isset($_GET['dl'])) { $doc = dbOne('SELECT * FROM dokumente WHERE id = ? AND trip_id = ?', [(int)$_GET['dl'], $tripId]); if ($doc && file_exists($uploadDir . $doc['dateiname'])) { header('Content-Type: ' . $doc['mime_type']); header('Content-Disposition: attachment; filename="' . addslashes($doc['name']) . '"'); readfile($uploadDir . $doc['dateiname']); exit; } http_response_code(404); exit; } $docs = dbAll('SELECT d.*, u.name as user_name FROM dokumente d LEFT JOIN users u ON u.id = d.created_by WHERE d.trip_id = ? ORDER BY d.created_at DESC', [$tripId]); function formatSize(int $bytes): string { if ($bytes < 1024) return $bytes . ' B'; if ($bytes < 1048576) return round($bytes / 1024, 1) . ' KB'; return round($bytes / 1048576, 1) . ' MB'; } $pageTitle = 'Dokumente'; $activeTab = 'dokumente'; include __DIR__ . '/includes/header.php'; ?>
📁

Noch keine Dokumente hochgeladen.

·