Commit 1bd5eb88 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

profileicons: leave validation if we catched error.


Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent c6903305
......@@ -161,15 +161,18 @@ function upload_validate(Pieform $form, $values) {
$imageinfo = getimagesize($values['file']['tmp_name']);
if (!$imageinfo || !is_image_type($imageinfo[2])) {
$form->set_error('file', get_string('filenotimage'));
return false;
}
if (get_field('artefact', 'COUNT(*)', 'artefacttype', 'profileicon', 'owner', $USER->id) >= 5) {
$form->set_error('file', get_string('onlyfiveprofileicons', 'artefact.file'));
return false;
}
$filesize = filesize($values['file']['tmp_name']);
$filesize = $um->file['size'];
if (!$USER->quota_allowed($filesize)) {
$form->set_error('file', get_string('profileiconuploadexceedsquota', 'artefact.file', get_config('wwwroot')));
return false;
}
// Check the file isn't greater than the max allowable size
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment