if (isset($fileInfo['extension'
])) { $extension =
$fileInfo['extension'
];
} } $extension =
strtolower($extension);
// Validate extension
// #1 - whitelist
$mappingService =
Shopware()->
Container()->
get(MediaExtensionMappingServiceInterface::
class);
if (!
$mappingService->
isAllowed($extension)) { throw new MediaFileExtensionNotAllowedException($extension);
} // #2 - blacklist
if (\
in_array($extension, Shopware_Controllers_Backend_MediaManager::
$fileUploadBlacklist, true
)) { throw new MediaFileExtensionIsBlacklistedException($extension);
} // Make sure that the name doesn't contain the file extension.
$name =
str_ireplace('.' .
$extension, '',
$name);
if ($extension === 'jpeg'
) { $name =
str_ireplace('.jpg', '',
$name);
}