Fix profile picture upload path by removing leading slash in directory and URL
This commit is contained in:
parent
26d665f2fe
commit
dde5ac9d28
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user