fix: 🐛 prevent use gallery upload as avatar
This commit is contained in:
parent
8e7299751e
commit
824fe614a4
@ -81,6 +81,7 @@ if ($_SERVER["REQUEST_METHOD"] === 'POST' && isset($_GET['upload'])) {
|
|||||||
|
|
||||||
// Move uploaded file to the target directory
|
// Move uploaded file to the target directory
|
||||||
if (move_uploaded_file($file["tmp_name"][0], $targetDir . $fileName)) {
|
if (move_uploaded_file($file["tmp_name"][0], $targetDir . $fileName)) {
|
||||||
|
if ($upload === 'avatar') {
|
||||||
$data['img'] = $targetDir . $fileName;
|
$data['img'] = $targetDir . $fileName;
|
||||||
try {
|
try {
|
||||||
Storage::set($id, $data);
|
Storage::set($id, $data);
|
||||||
@ -88,6 +89,7 @@ if ($_SERVER["REQUEST_METHOD"] === 'POST' && isset($_GET['upload'])) {
|
|||||||
catch(Exception $ex) {
|
catch(Exception $ex) {
|
||||||
exit("❌ Database error.");
|
exit("❌ Database error.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
http_response_code(200);
|
http_response_code(200);
|
||||||
exit(($upload === 'avatar'? $targetDir : '') . $fileName);
|
exit(($upload === 'avatar'? $targetDir : '') . $fileName);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user