withHeader('Content-Type', 'application/octet-stream'); $response = $response->withHeader('Content-Disposition', "attachment; filename=\"grocy-$dateTimeString.db\""); $response = $response->withHeader('Content-Length', filesize($databasePath)); $response->getBody()->write(file_get_contents($databasePath)); return $response; } else { return $response->withStatus(404, 'Database file not found'); } } }