fix: 🐛 prevent use gallery upload as avatar

This commit is contained in:
draconigen 2025-03-06 00:33:44 +01:00
parent 8e7299751e
commit 824fe614a4

View File

@ -81,6 +81,7 @@ if ($_SERVER["REQUEST_METHOD"] === 'POST' && isset($_GET['upload'])) {
// Move uploaded file to the target directory
if (move_uploaded_file($file["tmp_name"][0], $targetDir . $fileName)) {
if ($upload === 'avatar') {
$data['img'] = $targetDir . $fileName;
try {
Storage::set($id, $data);
@ -88,6 +89,7 @@ if ($_SERVER["REQUEST_METHOD"] === 'POST' && isset($_GET['upload'])) {
catch(Exception $ex) {
exit("❌ Database error.");
}
}
http_response_code(200);
exit(($upload === 'avatar'? $targetDir : '') . $fileName);