Code

Updated template upload behaviour.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Nov 2008 09:26:35 +0000 (09:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Nov 2008 09:26:35 +0000 (09:26 +0000)
-Only update filename if it is empty and keep path.

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

gosa-plugins/fai/admin/fai/class_faiTemplateEntry.inc

index 7ecd486cf7a9cafb30475adef6e83450ea19503b..27de8a512c2b5c43a0074222feffcc8b90d9693e 100644 (file)
@@ -72,8 +72,8 @@ class faiTemplateEntry extends plugin
         $this->FAItemplateFile = $str;
 
         /* If we don't have a filename set it from upload filename. */
-        if( 0 == strlen( $this->FAItemplatePath )){
-          $this->FAItemplatePath = $_FILES['FAItemplateFile']['name'];
+        if( 0 == strlen(preg_replace("/^.*\//","",$this->FAItemplatePath))){
+          $this->FAItemplatePath = preg_replace("/[^\/]*$/","",$this->FAItemplatePath).$_FILES['FAItemplateFile']['name'];
         }
 
         session::set('binary',$this->FAItemplateFile);