From 8be10bb100a6a4d9abc6bf7ee928d5c2e60004de Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 1 Oct 2011 19:53:37 -0400 Subject: Fixes #3912 checking that the upload succeeded before resizing --- actions/avatar/upload.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/avatar/upload.php b/actions/avatar/upload.php index 19976ea87..885a16557 100644 --- a/actions/avatar/upload.php +++ b/actions/avatar/upload.php @@ -11,6 +11,11 @@ if (!$owner || !($owner instanceof ElggUser) || !$owner->canEdit()) { forward(REFERER); } +if ($_FILES['avatar']['error'] != 0) { + register_error(elgg_echo('avatar:upload:fail')); + forward(REFERER); +} + //@todo make this configurable? $icon_sizes = array( 'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE), @@ -42,7 +47,7 @@ foreach ($icon_sizes as $name => $size_info) { $file->delete(); } - system_message(elgg_echo('avatar:resize:fail')); + register_error(elgg_echo('avatar:resize:fail')); forward(REFERER); } } -- cgit v1.2.3