]> _ Git - cubeextranet.git/commitdiff
wip #4613 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 22 Jul 2021 16:23:54 +0000 (16:23 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 22 Jul 2021 16:23:54 +0000 (16:23 +0000)
inc/ws/Controlleur/class.ws.flash.php

index 0f6ed14c233fc068fa491895866cbfa58ba9c738..b5794c4701e2eba9843c25191a4d2cf45f757f85 100644 (file)
@@ -206,22 +206,18 @@ class wsFlash extends cubeFlashGateway
             if ($infos['error']) {
                 continue;
             }
-            $fname = cubeFiles::tidyName($infos['name']);
-            $res = $fname;
-            $dir = WS_THEMES . '/' . $this->args['theme_id'] . '/';
-            $dest = $dir . $fname;
+            $fname = $this->args['fieldname'] . '_' . cubeFiles::tidyName($infos['name']);
 
-            if (!file_exists(WS_THEMES . '/' . $this->args['theme_id'])) {
-                mkdir(WS_THEMES . '/' . $this->args['theme_id'], 0755, true);
-            }
+            $tmp = sys_get_temp_dir() . '/' . $fname;
+            move_uploaded_file($infos['tmp_name'],$tmp);
 
-            move_uploaded_file($infos['tmp_name'], $dest);
-            try {
-                $api = new ws3API();
-                $api->uploadThemeFile($this->args['theme_id'], $this->args['fieldname'], $dest);
-            } catch (Exception $e) {
+            $api = new ws3API();
+            $api->uploadThemeFile($this->args['theme_id'], $this->args['fieldname'], $tmp);
+
+
+            $dir = WS_FILES . '/themes3/' . $this->args['theme_id'];
+            $dest = $dir . '/' . $fname;
 
-            }
 
             if (isset($this->args['type']) && $this->args['type'] == 'favicon') {
                 $icotool = new cubeCommandLine('icotool');