diff --git a/application/Espo/Controllers/Attachment.php b/application/Espo/Controllers/Attachment.php index ac73a618ff..94feb87afb 100644 --- a/application/Espo/Controllers/Attachment.php +++ b/application/Espo/Controllers/Attachment.php @@ -44,8 +44,13 @@ class Attachment extends \Espo\Core\Controllers\Record throw new Forbidden(); } - list($prefix, $contents) = explode(',', $data); - $contents = base64_decode($contents); + $arr = explode(',', $data); + if (count($arr) > 1) { + list($prefix, $contents) = $arr; + $contents = base64_decode($contents); + } else { + $contents = ''; + } $attachment = $this->getEntityManager()->getEntity('Attachment'); $this->getEntityManager()->saveEntity($attachment);