[-] BO : #PSTEST-595 - Fix Bug with image uploading
[-] BO : #PSTEST-596 - Fix Bug with image uploading [-] BO : #PSTEST-597 - Fix Bug with image uploading
This commit is contained in:
@@ -2436,11 +2436,14 @@ class AdminControllerCore extends Controller
|
|||||||
$max_size = isset($this->max_image_size) ? $this->max_image_size : 0;
|
$max_size = isset($this->max_image_size) ? $this->max_image_size : 0;
|
||||||
if ($error = ImageManager::validateUpload($_FILES[$name], Tools::getMaxUploadSize($max_size)))
|
if ($error = ImageManager::validateUpload($_FILES[$name], Tools::getMaxUploadSize($max_size)))
|
||||||
$this->errors[] = $error;
|
$this->errors[] = $error;
|
||||||
else if (!($tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($_FILES[$name]['tmp_name'], $tmp_name))
|
|
||||||
|
$tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
|
||||||
|
if (!$tmp_name)
|
||||||
return false;
|
return false;
|
||||||
else
|
|
||||||
{
|
if (!move_uploaded_file($_FILES[$name]['tmp_name'], $tmp_name))
|
||||||
$tmp_name = $_FILES[$name]['tmp_name'];
|
return false;
|
||||||
|
|
||||||
// Copy new image
|
// Copy new image
|
||||||
if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.$dir.$id.'.'.$this->imageType, (int)$width, (int)$height, ($ext ? $ext : $this->imageType)))
|
if (!ImageManager::resize($tmp_name, _PS_IMG_DIR_.$dir.$id.'.'.$this->imageType, (int)$width, (int)$height, ($ext ? $ext : $this->imageType)))
|
||||||
$this->errors[] = Tools::displayError('An error occurred while uploading image.');
|
$this->errors[] = Tools::displayError('An error occurred while uploading image.');
|
||||||
@@ -2453,7 +2456,6 @@ class AdminControllerCore extends Controller
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user