Refactor target directory path handling for profile picture uploads to correct directory structure
This commit is contained in:
parent
1f479927e2
commit
391f9332e2
@ -65,8 +65,8 @@ $ext = $allowedMimeToExt[$mime];
|
||||
$documentRoot = isset($_SERVER['DOCUMENT_ROOT']) ? (string)$_SERVER['DOCUMENT_ROOT'] : '';
|
||||
$webRoot = rtrim($documentRoot, "\\/");
|
||||
$targetDir = $webRoot !== ''
|
||||
? $webRoot . '/FSST/Website'
|
||||
: __DIR__ . '/FSST/Website/assets/images/profilePictures';
|
||||
? $webRoot . 'assets/images/profilePictures'
|
||||
: __DIR__ . 'assets/images/profilePictures';
|
||||
|
||||
if (!is_dir($targetDir))
|
||||
{
|
||||
@ -97,7 +97,7 @@ if (!move_uploaded_file($tmp, $targetPath))
|
||||
$lastErr = error_get_last();
|
||||
$lastErrMsg = (is_array($lastErr) && isset($lastErr['message'])) ? (string)$lastErr['message'] : 'unknown';
|
||||
error_log('Upload: move_uploaded_file failed to ' . $targetPath . ' - ' . $lastErrMsg);
|
||||
header('Location: account.php?upload=err');
|
||||
header('Location: account.php?upload=err&code=move');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user