aboutsummaryrefslogtreecommitdiff
path: root/mod/profile/actions/iconupload.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 10:16:49 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 10:16:49 +0000
commit45701db779d3e310a14afde5e8ff9d7cab56c533 (patch)
tree0a30870d056012f90d529480c63a534c6e2fa811 /mod/profile/actions/iconupload.php
parentd53a7b7a2d48a4a47bcec28779a4a7276c954a1b (diff)
downloadelgg-45701db779d3e310a14afde5e8ff9d7cab56c533.tar.gz
elgg-45701db779d3e310a14afde5e8ff9d7cab56c533.tar.bz2
Better error reporting on previous.
git-svn-id: https://code.elgg.org/elgg/trunk@570 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/profile/actions/iconupload.php')
-rw-r--r--mod/profile/actions/iconupload.php36
1 files 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 {