From 0a7505416e3c3262ae75154710f5fc5cf9c5b818 Mon Sep 17 00:00:00 2001 From: fixclean Date: Fri, 13 Feb 2026 11:27:48 +0100 Subject: [PATCH] svg upload in floors ausgebaut --- app/modules/floors/edit.php | 9 +-------- app/modules/floors/save.php | 36 +----------------------------------- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/app/modules/floors/edit.php b/app/modules/floors/edit.php index 6ee02f1..e3aa37c 100644 --- a/app/modules/floors/edit.php +++ b/app/modules/floors/edit.php @@ -38,7 +38,7 @@ if (!empty($floor['svg_path'])) {

-
+ @@ -86,12 +86,6 @@ if (!empty($floor['svg_path'])) {
Grundriss (SVG) -
- - - Optional. Wenn ein Zeichnungsinhalt im Editor erstellt wird, wird dieser beim Speichern bevorzugt. -
-
@@ -178,7 +172,6 @@ if (!empty($floor['svg_path'])) { .form-group input[type="text"], .form-group input[type="number"], -.form-group input[type="file"], .form-group select, .form-group textarea { width: 100%; diff --git a/app/modules/floors/save.php b/app/modules/floors/save.php index a5bf8dd..0bd3012 100644 --- a/app/modules/floors/save.php +++ b/app/modules/floors/save.php @@ -43,43 +43,9 @@ if (!empty($errors)) { } // ========================= -// SVG-Upload verarbeiten (optional) +// SVG aus Editor verarbeiten (optional) // ========================= $svgPath = null; -if (!empty($_FILES['svg_file']['name'])) { - $file = $_FILES['svg_file']; - $tmpName = $file['tmp_name']; - $originalName = basename($file['name']); - $fileExt = strtolower(pathinfo($originalName, PATHINFO_EXTENSION)); - - // Nur SVG erlaubt - if ($fileExt !== 'svg') { - $_SESSION['error'] = "Nur SVG-Dateien sind erlaubt"; - $redirectUrl = $floorId ? "?module=floors&action=edit&id=$floorId" : "?module=floors&action=edit"; - header("Location: $redirectUrl"); - exit; - } - - // Zielverzeichnis - $uploadDir = __DIR__ . '/../../uploads/floorplans/'; - if (!is_dir($uploadDir)) { - mkdir($uploadDir, 0755, true); - } - - // Eindeutiger Dateiname - $newFileName = uniqid('floor_') . '.svg'; - $destPath = $uploadDir . $newFileName; - - if (move_uploaded_file($tmpName, $destPath)) { - $svgPath = 'uploads/floorplans/' . $newFileName; - } else { - $_SESSION['error'] = "Datei-Upload fehlgeschlagen"; - $redirectUrl = $floorId ? "?module=floors&action=edit&id=$floorId" : "?module=floors&action=edit"; - header("Location: $redirectUrl"); - exit; - } -} - if ($floorSvgContent !== '') { $storedSvgPath = storeSvgEditorContent($sql, $floorId, $floorSvgContent); if ($storedSvgPath === false) {