Fix: Missing error message when files were too large.
This commit is contained in:
parent
6ffdc039a2
commit
628e8bea83
@ -321,6 +321,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
||||
$result=$object->update($user,0,$nosyncuser,$nosyncuserpass);
|
||||
if ($result >= 0 && ! count($object->errors))
|
||||
{
|
||||
// Logo/Photo save
|
||||
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1).'/photos';
|
||||
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
||||
if ($file_OK)
|
||||
@ -361,8 +362,21 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
||||
$errmsgs[] = "ErrorBadImageFormat";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch($_FILES['photo']['error'])
|
||||
{
|
||||
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
|
||||
$errors[] = "ErrorFileSizeTooLarge";
|
||||
break;
|
||||
case 3: //uploaded file was only partially uploaded
|
||||
$errors[] = "ErrorFilePartiallyUploaded";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$rowid=$object->id;
|
||||
$rowid=$object->id;
|
||||
$action='';
|
||||
|
||||
if (! empty($backtopage))
|
||||
|
||||
@ -4,11 +4,10 @@
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -280,7 +279,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Gestion du logo de la société
|
||||
// Logo/Photo save
|
||||
$dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/";
|
||||
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
||||
if ($file_OK)
|
||||
@ -311,6 +310,19 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch($_FILES['photo']['error'])
|
||||
{
|
||||
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
|
||||
$errors[] = "ErrorFileSizeTooLarge";
|
||||
break;
|
||||
case 3: //uploaded file was only partially uploaded
|
||||
$errors[] = "ErrorFilePartiallyUploaded";
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Gestion du logo de la société
|
||||
}
|
||||
else
|
||||
@ -354,7 +366,7 @@ if (empty($reshook))
|
||||
$error = $object->error; $errors = $object->errors;
|
||||
}
|
||||
|
||||
// Gestion du logo de la société
|
||||
// Logo/Photo save
|
||||
$dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos";
|
||||
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
||||
if ($file_OK)
|
||||
@ -393,10 +405,23 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$errors[] = "ErrorBadImageFormat";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch($_FILES['photo']['error'])
|
||||
{
|
||||
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
|
||||
$errors[] = "ErrorFileSizeTooLarge";
|
||||
break;
|
||||
case 3: //uploaded file was only partially uploaded
|
||||
$errors[] = "ErrorFilePartiallyUploaded";
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Gestion du logo de la société
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user