From 45701db779d3e310a14afde5e8ff9d7cab56c533 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 30 Apr 2008 10:16:49 +0000 Subject: Better error reporting on previous. git-svn-id: https://code.elgg.org/elgg/trunk@570 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/actions/iconupload.php | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/mod/profile/actions/iconupload.php b/mod/profile/actions/iconupload.php index 10a55be1c..3c41f48a4 100644 --- a/mod/profile/actions/iconupload.php +++ b/mod/profile/actions/iconupload.php @@ -19,21 +19,29 @@ $medium = get_resized_image_from_uploaded_file('profileicon',100,100); $large = get_resized_image_from_uploaded_file('profileicon',300,300); - $filehandler = new ElggFile(); - $filehandler->setFilename($_SESSION['user']->username . "large.jpg"); - $filehandler->open("write"); - $filehandler->write($large); - $filehandler->close(); - $filehandler->setFilename($_SESSION['user']->username . "medium.jpg"); - $filehandler->open("write"); - $filehandler->write($medium); - $filehandler->close(); - $filehandler->setFilename($_SESSION['user']->username . "small.jpg"); - $filehandler->open("write"); - $filehandler->write($small); - $filehandler->close(); + if ($small !== false + && $medium !== false + && $large !== false) { - system_message(elgg_echo("profile:icon:uploaded")); + $filehandler = new ElggFile(); + $filehandler->setFilename($_SESSION['user']->username . "large.jpg"); + $filehandler->open("write"); + $filehandler->write($large); + $filehandler->close(); + $filehandler->setFilename($_SESSION['user']->username . "medium.jpg"); + $filehandler->open("write"); + $filehandler->write($medium); + $filehandler->close(); + $filehandler->setFilename($_SESSION['user']->username . "small.jpg"); + $filehandler->open("write"); + $filehandler->write($small); + $filehandler->close(); + + system_message(elgg_echo("profile:icon:uploaded")); + + } else { + system_message(elgg_echo("profile:icon:notfound")); + } } else { -- cgit v1.2.3