diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ecf95c5096d..05d9049ff03 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1540,17 +1540,30 @@ class Categorie extends CommonObject dol_mkdir($dir); } - if (file_exists($dir)) - { - $originImage = $dir . $file['name']; + if (file_exists($dir)) { + if (is_array($file['name']) && count($file['name']) > 0) { + for($i = 0; $i <= count($file['name']); $i ++) { - // Cree fichier en taille origine - dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0); + $originImage = $dir . $file['name'][$i]; - if (file_exists($originImage)) - { - // Create thumbs - $this->addThumbs($originImage); + // Cree fichier en taille origine + dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0); + + if (file_exists($originImage)) { + // Create thumbs + $this->addThumbs($originImage); + } + } + } else { + $originImage = $dir . $file['name']; + + // Cree fichier en taille origine + dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0); + + if (file_exists($originImage)) { + // Create thumbs + $this->addThumbs($originImage); + } } } }