svg upload in floors ausgebaut

This commit is contained in:
2026-02-13 11:27:48 +01:00
parent 2b9726d362
commit 0a7505416e
2 changed files with 2 additions and 43 deletions

View File

@@ -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) {