Add protection to allow only jpg and png as image file

This commit is contained in:
Laurent Destailleur 2020-08-06 17:37:00 +02:00
parent 582ae36e6c
commit 61e194bb6d

View File

@ -111,6 +111,12 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
foreach ($arrayofimages as $varforimage)
{
if (! preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["tmp_name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
break;
}
if ($_FILES[$varforimage]["tmp_name"])
{
$reg = array();