From 824fe614a43e250caf9f17a6a44730c495d71dfc Mon Sep 17 00:00:00 2001 From: draconigen Date: Thu, 6 Mar 2025 00:33:44 +0100 Subject: [PATCH] fix: :bug: prevent use gallery upload as avatar --- index.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index c35ef61..f406bc3 100644 --- a/index.php +++ b/index.php @@ -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);