db(); $attachment = Attachment::byId($db, $variables["id"]); if ($attachment === null) { (new NotFoundHandler())->handle($env, []); return; } header("Content-Type: {$attachment->getMime()}"); readfile($attachment->getFilePath($env->attachmentsPath())); } }