Merge pull request #10010 from atm-john/Fix_cat_photo_upload
Fix event message on upload category picture fail
This commit is contained in:
commit
f3228dc4f8
@ -69,7 +69,24 @@ if ($id > 0)
|
||||
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id) {
|
||||
$object->add_photo($upload_dir, $_FILES['userfile']);
|
||||
|
||||
$file = $_FILES['userfile'];
|
||||
if (is_array($file['name']) && count($file['name']) > 0)
|
||||
{
|
||||
foreach ($file['name'] as $i => $name)
|
||||
{
|
||||
if(empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]) )
|
||||
{
|
||||
setEventMessage($file['name'][$i] .' : '. $langs->trans(empty($file['tmp_name'][$i])? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles' ) );
|
||||
unset($file['name'][$i],$file['type'][$i],$file['tmp_name'][$i],$file['error'][$i],$file['size'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($file['tmp_name'])){
|
||||
$object->add_photo($upload_dir, $file);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1635,7 +1635,7 @@ class FormFile
|
||||
*/
|
||||
private function _formAjaxFileUpload($object)
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
|
||||
// PHP post_max_size
|
||||
$post_max_size = ini_get('post_max_size');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user