Add protection to allow only jpg and png as image file

This commit is contained in:
Laurent Destailleur 2020-08-06 17:39:36 +02:00
parent 61e194bb6d
commit edd19419ad

View File

@ -111,7 +111,7 @@ 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.
if ($_FILES[$varforimage]["name"] && ! preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["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;