Code

Updated handling of uploaded files, thanks to bcooksley
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Nov 2010 09:16:06 +0000 (09:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Nov 2010 09:16:06 +0000 (09:16 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20256 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/generic/class_user.inc

index b3ecc5f1d0d0ef3153b51312c112d8dabfd43900..4a3a642fcddf6d2c98a271205abce17d1988c7c6 100644 (file)
@@ -424,11 +424,12 @@ class user extends plugin
 
         /* Check for clean upload */
         if ($_FILES['picture_file']['name'] != ""){
-            if (!file_exists($_FILES['picture_file']['tmp_name'])) {
+            $filename = gosa_file_name($_FILES['picture_file']['tmp_name']);
+            if (!file_exists($filename)) {
                 msg_dialog::display(_("Error"), _("Cannot upload file!"), ERROR_DIALOG);
             }else{
                 /* Activate new picture */
-                $this->set_picture($_FILES['picture_file']['tmp_name']);
+                $this->set_picture($filename);
             }
         }
         $this->picture_dialog= FALSE;
@@ -508,7 +509,7 @@ class user extends plugin
               array_key_exists('name', $_FILES[$val."_file"]) &&
               $_FILES[$val."_file"]['name'] != "" &&
               is_readable($_FILES[$val."_file"]['tmp_name'])) {
-            $this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
+            $this->set_cert("$val", gosa_file_name($_FILES[$val."_file"]['tmp_name']));
           }
         }
 
@@ -1597,7 +1598,7 @@ class user extends plugin
     $this->set_acl_base($this->base);
 
     if((isset($_FILES['picture_file']['tmp_name'])) && ($_FILES['picture_file']['size'] > 0)){
-      $this->set_picture($_FILES['picture_file']['tmp_name']);
+      $this->set_picture(gosa_file_name($_FILES['picture_file']['tmp_name']));
     }
 
     /* Remove picture? */