Skip to content
Snippets Groups Projects
Commit 9f0560d5 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #157 from Bastian-Kuhn/fix-attachments


Fix uploading attachments from eMail

Reviewed-by: default avatarJared Hancock <jared@osticket.com>
parents 44feb00d f2e3225d
No related branches found
No related tags found
No related merge requests found
...@@ -123,7 +123,7 @@ if($cfg->allowEmailAttachments()) { ...@@ -123,7 +123,7 @@ if($cfg->allowEmailAttachments()) {
//print_r($attachments); //print_r($attachments);
foreach($attachments as $k=>$attachment){ foreach($attachments as $k=>$attachment){
if($attachment['filename'] && $cfg->canUploadFileType($attachment['filename'])) { if($attachment['filename'] && $cfg->canUploadFileType($attachment['filename'])) {
$ticket->saveAttachment($attachment['filename'],$attachment['body'],$msgid,'M'); $ticket->saveAttachment(array('name' => $attachment['filename'], 'data' => $attachment['body']),$msgid,'M');
} }
} }
} }
......
...@@ -330,7 +330,7 @@ class MailFetcher { ...@@ -330,7 +330,7 @@ class MailFetcher {
if($ticket && $cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) { if($ticket && $cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) {
//extract the attachments...and do the magic. //extract the attachments...and do the magic.
$data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$index)); $data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$index));
$ticket->saveAttachment($filename,$data,$ticket->getLastMsgId(),'M'); $ticket->saveAttachment(array('name'=>$filename, 'data'=>$data),$ticket->getLastMsgId(),'M');
return; return;
} }
//TODO: Log failure?? //TODO: Log failure??
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment