Code

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

gosa-plugins/ldapmanager/addons/ldapmanager/class_import.inc

index 38f0a5aba15166c910a7d5e35da7b75c2eaf43fb..f00e7b2fd6d24892c2052cdc6bc4b673ece605e6 100644 (file)
@@ -60,6 +60,8 @@ class ldifimport extends plugin
                 $smarty->assign("type","importfile");
                 $handle = NULL;
 
+                $filename = gosa_file_name($_FILES['userfile']['tmp_name']);
+
                 // Check if there is a file submitted
                 if(!$_FILES['userfile']['size'] > 0 )
                 {
@@ -68,7 +70,7 @@ class ldifimport extends plugin
                 }
 
                 // 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);
@@ -76,7 +78,7 @@ class ldifimport extends plugin
                 }
 
                 // Can we open the tmp file, for reading
-                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);