Example #1
0
 /**
  * @param array $fileData
  * @param string $siteID
  * @return int|false
  */
 public static function saveEmailAttachment(array $fileData, $storageTypeID = 0, $siteID = '')
 {
     if (!is_integer($storageTypeID)) {
         $storageTypeID = (int) $storageTypeID;
     }
     if (!StorageType::isDefined($storageTypeID)) {
         $storageTypeID = StorageType::getDefaultTypeID();
     }
     if ($storageTypeID === StorageType::Disk) {
         return DiskManager::saveEmailAttachment($fileData, $siteID);
     } elseif ($storageTypeID === StorageType::WebDav) {
         return \CCrmWebDavHelper::saveEmailAttachment($fileData, $siteID);
     }
     throw new Main\NotSupportedException("Storage type: '{$storageTypeID}' is not supported in current context");
 }