BUGFIX Better checking of file validity (#6093) Thanks Pigeon

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@113419 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Jean-Fabien Barrios 2010-11-04 00:58:34 +00:00 committed by Sam Minnee
parent fe26454567
commit e2d4dc25dc

View File

@ -105,7 +105,12 @@ JS;
// submitted data for file upload fields come back as an array // submitted data for file upload fields come back as an array
$value = isset($data[$fieldName]) ? $data[$fieldName] : null; $value = isset($data[$fieldName]) ? $data[$fieldName] : null;
if(is_array($value)) { if(is_array($value)) {
$error = ($value) ? false : true; if ($formField instanceof FileField && isset($value['error']) && $value['error']) {
$error = true;
}
else {
$error = (count($value)) ? false : true;
}
} else { } else {
// assume a string or integer // assume a string or integer
$error = (strlen($value)) ? false : true; $error = (strlen($value)) ? false : true;