svalavuo 1 өдөр өмнө
parent
commit
bca15d8765

+ 2 - 2
backend/models/Attachment.php

@@ -132,14 +132,14 @@ class Attachment {
             $this->filename = $uniqueFileName;
             $this->original_name = $file['name'];
             $this->file_type = $file_type;
-            $this->file_path = $uploadPath;
+            $this->file_path = $uniqueFileName;
             $this->file_size = $file['size'];
             $this->mime_type = $file['type'];
 
             if ($this->create()) {
                 $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
                 $apiPath = dirname($_SERVER['PHP_SELF']);
-                $fullUrl = $baseUrl . '/uploads/' . $uploadPath;
+                $fullUrl = $baseUrl . '/uploads/' . $uniqueFileName;
                 
                 return ['success' => true, 'url' => $fullUrl, 'id' => $this->conn->lastInsertId()];
             } else {