summaryrefslogtreecommitdiff
path: root/program/steps/mail/attachments.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-02-09 13:10:12 +0000
committeralecpl <alec@alec.pl>2010-02-09 13:10:12 +0000
commit91790e41f3fa307658077043bc2fa5f71e270cf4 (patch)
tree9864a79c0524eb064c2d07b78180394d5d9c9adf /program/steps/mail/attachments.inc
parent5c54cc0ee6de44960bbc4cfab3d456a4805a0692 (diff)
- Fix attachment excessive memory use, support messages of any size (#1484660)
Diffstat (limited to 'program/steps/mail/attachments.inc')
-rw-r--r--program/steps/mail/attachments.inc7
1 files changed, 5 insertions, 2 deletions
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])
);