From: hickert Date: Thu, 14 Oct 2010 07:54:06 +0000 (+0000) Subject: Updated file upload tests X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=44699df87667bfce67f6f3bcf0190c791820349f;p=gosa.git Updated file upload tests -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 --- diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index 5d4b0f326..b3ecc5f1d 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -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']); } } diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc index 0041bd90f..7bb990cc6 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc @@ -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); }