better fix

This commit is contained in:
florian HENRY 2017-09-08 10:34:38 +02:00
parent da2f971345
commit 20ed279489

View File

@ -1542,17 +1542,27 @@ class Categorie extends CommonObject
dol_mkdir($dir); dol_mkdir($dir);
} }
if (file_exists($dir)) if (file_exists($dir)) {
{ if (is_array($file['name']) && count($file['name']) > 0) {
for ($i=0;$i<=count($file['name']);$i++) { for($i = 0; $i <= count($file['name']); $i ++) {
$originImage = $dir . $file['name'][$i]; $originImage = $dir . $file['name'][$i];
// Cree fichier en taille origine // Cree fichier en taille origine
dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0); dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0);
if (file_exists($originImage)) 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 // Create thumbs
$this->addThumbs($originImage); $this->addThumbs($originImage);
} }