Skip to content

Commit

Permalink
better fix
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-florian committed Sep 8, 2017
1 parent da2f971 commit 20ed279
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions htdocs/categories/class/categorie.class.php
Expand Up @@ -1542,18 +1542,28 @@ function add_photo($sdir, $file)
dol_mkdir($dir);
}

if (file_exists($dir))
{
for ($i=0;$i<=count($file['name']);$i++) {
if (file_exists($dir)) {
if (is_array($file['name']) && count($file['name']) > 0) {
for($i = 0; $i <= count($file['name']); $i ++) {

$originImage = $dir . $file['name'][$i];
$originImage = $dir . $file['name'][$i];

// 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'][$i], $originImage, 1, 0, 0);
dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);

if (file_exists($originImage))
{
// Create thumbs
if (file_exists($originImage)) {
// Create thumbs
$this->addThumbs($originImage);
}
}
Expand Down

0 comments on commit 20ed279

Please sign in to comment.