= $file_mtime) ) { http_response_code(304); exit; } // Audit log - not for an agent viewing as the contact, nor a picture in the ticket's text, which opening the ticket shows (functions/ticket_pictures.php) if (!portalViewingAs() && !ticketAttachmentIsPicture($row)) { logAudit("Ticket", "Download", "Client contact $session_contact_name viewed ticket attachment $attachment_name_escaped via portal", $session_client_id); } // Send the file header("Content-Type: $attachment_mime_type"); header("Content-Disposition: $disposition; filename=\"$safe_attachment_name\""); header("Content-Length: " . filesize($file_path)); header("X-Content-Type-Options: nosniff"); // Clear output buffers so large files stream instead of loading into memory while (ob_get_level()) { ob_end_clean(); } readfile($file_path); exit;