svg upload in floors ausgebaut
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user