]> jfr.im git - uguu.git/blobdiff - static/php/upload.php
1.5.0 changes
[uguu.git] / static / php / upload.php
index 3a9b0f9af0984cdf00e4b485d1c0d9958e905300..37458a98e85477b862a409b2f4a6c41d6f54cf0a 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Uguu
  *
- * @copyright Copyright (c) 2022 Go Johansson (nekunekus) <neku@pomf.se> <github.com/nokonoko>
+ * @copyright Copyright (c) 2022 Go Johansson (nokonoko) <neku@pomf.se>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,13 +24,15 @@ $type = $_GET['output'] ?? 'json';
 $response = (new Core\Response($type));
 
 if (isset($_FILES['files'])) {
-    $uploads = (new Upload())->reFiles($_FILES['files']);
+    $uploads = Upload::reFiles($_FILES['files']);
 
     try {
         foreach ($uploads as $upload) {
-            $res[] = (new Upload())->uploadFile($upload);
+            $res[] = Upload::uploadFile();
+        }
+        if (isset($res)) {
+            $response->send($res);
         }
-        $response->send($res);
     } catch (Exception $e) {
         $response->error($e->getCode(), $e->getMessage());
     }