From dde5ac9d28aad0cdf9603adcfba5597aa97324d8 Mon Sep 17 00:00:00 2001 From: Fabian Schieder Date: Sun, 25 Jan 2026 22:42:24 +0100 Subject: [PATCH] Fix profile picture upload path by removing leading slash in directory and URL --- upload.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/upload.php b/upload.php index 7ecc937..b4ba069 100644 --- a/upload.php +++ b/upload.php @@ -65,8 +65,8 @@ $ext = $allowedMimeToExt[$mime]; $documentRoot = isset($_SERVER['DOCUMENT_ROOT']) ? (string)$_SERVER['DOCUMENT_ROOT'] : ''; $webRoot = rtrim($documentRoot, "\\/"); $targetDir = $webRoot !== '' - ? $webRoot . '/assets/images/profilePictures' - : __DIR__ . '/assets/images/profilePictures'; + ? $webRoot . 'assets/images/profilePictures' + : __DIR__ . 'assets/images/profilePictures'; if (!is_dir($targetDir)) { @@ -102,7 +102,7 @@ if (!move_uploaded_file($tmp, $targetPath)) } // Pfad, der in HTML genutzt wird (URL relativ zur Webroot) -$publicPath = '/assets/images/profilePictures/' . $filename; +$publicPath = 'assets/images/profilePictures/' . $filename; $servername = "localhost"; $port = 3306;