Code

Updated file upload tests
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 14 Oct 2010 07:54:06 +0000 (07:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 14 Oct 2010 07:54:06 +0000 (07:54 +0000)
-After we've moved the uploaded file using 'move_uploaded_file' the function 'is_uploaded_file' just fails.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20040 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/generic/class_user.inc
gosa-plugins/goto/admin/applications/class_applicationGeneric.inc

index 5d4b0f3264022ed07088b9348e205b620990a676..b3ecc5f1d0d0ef3153b51312c112d8dabfd43900 100644 (file)
@@ -422,16 +422,16 @@ class user extends plugin
     /* Save picture */
     if (isset($_POST['picture_edit_finish'])){
 
-      /* Check for clean upload */
-      if ($_FILES['picture_file']['name'] != ""){
-        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
-          msg_dialog::display(_("Error"), _("Cannot upload file!"), ERROR_DIALOG);
-        }else{
-          /* Activate new picture */
-          $this->set_picture($_FILES['picture_file']['tmp_name']);
+        /* Check for clean upload */
+        if ($_FILES['picture_file']['name'] != ""){
+            if (!file_exists($_FILES['picture_file']['tmp_name'])) {
+                msg_dialog::display(_("Error"), _("Cannot upload file!"), ERROR_DIALOG);
+            }else{
+                /* Activate new picture */
+                $this->set_picture($_FILES['picture_file']['tmp_name']);
+            }
         }
-      }
-      $this->picture_dialog= FALSE;
+        $this->picture_dialog= FALSE;
       $this->dialog= FALSE;
       $this->is_modified= TRUE;
     }
@@ -507,7 +507,7 @@ class user extends plugin
           if (array_key_exists($val."_file", $_FILES) &&
               array_key_exists('name', $_FILES[$val."_file"]) &&
               $_FILES[$val."_file"]['name'] != "" &&
-              is_uploaded_file($_FILES[$val."_file"]['tmp_name'])) {
+              is_readable($_FILES[$val."_file"]['tmp_name'])) {
             $this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
           }
         }
index 0041bd90f2bbac8143934d11368500222cf2da0f..7bb990cc6fcf2e057387a9ddd41342baf3571f3d 100644 (file)
@@ -327,7 +327,7 @@ class application extends plugin
       /* Check for picture upload */
       if (isset($_FILES['picture_file']['name']) && $_FILES['picture_file']['name'] != ""){
 
-        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
+        if (!is_readable($_FILES['picture_file']['tmp_name'])) {
           msg_dialog::display(_("Error"), msgPool::incorrectUpload(), ERROR_DIALOG);
         }