From: hickert Date: Wed, 17 Nov 2010 09:15:15 +0000 (+0000) Subject: Updated handling of uploaded files, thanks to bcooksley X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ada9628bbca72bea82b1f4aa358bc1262071250b;p=gosa.git Updated handling of uploaded files, thanks to bcooksley git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20243 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/ldapmanager/addons/ldapmanager/class_csvimport.inc b/gosa-plugins/ldapmanager/addons/ldapmanager/class_csvimport.inc index 6006edf7d..2dfabee20 100644 --- a/gosa-plugins/ldapmanager/addons/ldapmanager/class_csvimport.inc +++ b/gosa-plugins/ldapmanager/addons/ldapmanager/class_csvimport.inc @@ -336,26 +336,28 @@ class csvimport extends plugin $handle = NULL; + $filename = gosa_file_name($_FILES['userfile']['tmp_name']); + if((!isset($_FILES['userfile']['name']))||(!isset($_POST['fileup']))) { - msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file not found")), ERROR_DIALOG); - $smarty->assign("LDIFError",TRUE); + msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file not found")), ERROR_DIALOG); + $smarty->assign("LDIFError",TRUE); } elseif(!$_FILES['userfile']['size'] > 0 ) { - msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file is empty")), ERROR_DIALOG); - $smarty->assign("LDIFError",TRUE); + msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file is empty")), ERROR_DIALOG); + $smarty->assign("LDIFError",TRUE); } /* Is there a tmp file, which we can use ? */ - elseif(!file_exists($_FILES['userfile']['tmp_name'])) + elseif(!file_exists($filename)) { - msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file not found")), ERROR_DIALOG); - $smarty->assign("LDIFError",TRUE); + msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file not found")), ERROR_DIALOG); + $smarty->assign("LDIFError",TRUE); } - elseif(!$handle = @fopen($_FILES['userfile']['tmp_name'],"r")) + elseif(!$handle = @fopen($filename,"r")) { - msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file not readable")), ERROR_DIALOG); - $smarty->assign("LDIFError",TRUE); + msg_dialog::display(_("Error"), sprintf(_("Cannot read uploaded file: %s"), _("file not readable")), ERROR_DIALOG); + $smarty->assign("LDIFError",TRUE); } else {