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,12 +81,14 @@ 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)) {
$data['img'] = $targetDir . $fileName;
try {
Storage::set($id, $data);
}
catch(Exception $ex) {
exit("❌ Database error.");
if ($upload === 'avatar') {
$data['img'] = $targetDir . $fileName;
try {
Storage::set($id, $data);
}
catch(Exception $ex) {
exit("❌ Database error.");
}
}
http_response_code(200);