From 91790e41f3fa307658077043bc2fa5f71e270cf4 Mon Sep 17 00:00:00 2001 From: alecpl Date: Tue, 9 Feb 2010 13:10:12 +0000 Subject: - Fix attachment excessive memory use, support messages of any size (#1484660) --- program/steps/mail/attachments.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'program/steps/mail/attachments.inc') diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc index d0808d080..2b4a59024 100644 --- a/program/steps/mail/attachments.inc +++ b/program/steps/mail/attachments.inc @@ -53,9 +53,11 @@ if ($RCMAIL->action=='display-attachment') $attachment = $RCMAIL->plugins->exec_hook('display_attachment', $attachment); if ($attachment['status']) { - $size = $attachment['data'] ? strlen($attachment['data']) : @filesize($attachment['path']); + if (empty($attachment['size'])) + $attachment['size'] = $attachment['data'] ? strlen($attachment['data']) : @filesize($attachment['path']); + header('Content-Type: ' . $attachment['mimetype']); - header('Content-Length: ' . $size); + header('Content-Length: ' . $attachment['size']); if ($attachment['data']) echo $attachment['data']; @@ -80,6 +82,7 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) { $attachment = array( 'path' => $filepath, + 'size' => $_FILES['_attachments']['size'][$i], 'name' => $_FILES['_attachments']['name'][$i], 'mimetype' => rc_mime_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]) ); -- cgit v1.2.3