[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Tiki API: Add support for uploading new versions of files

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68925b05c7779_2cd5cc8536f0@gitlab-sidekiq-low-urgency-cpu-bound-v2-6b9b65f69d-tjqfg.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
865d0716 by Bruno Kambere at 2025-08-05T19:19:17+00:00
[ENH] Tiki API: Add support for uploading new versions of files
---
* [ENH] Tiki API: Add support for uploading new versions of files

See merge request tikiwiki/tiki!8049

- - - - -


2 changed files:

- lib/core/Services/File/Controller.php
- templates/api/docs/paths/galleries/upload.yaml


Changes:

=====================================
lib/core/Services/File/Controller.php
=====================================
@@ -102,7 +102,13 @@ class Services_File_Controller
         }
 
         $gal_info = $this->checkTargetGallery($input);
-        $fileId = $input->update->int() ? $input->fileId->int() : false;
+
+        if (($input->update->int() || $input->upload->int()) && $input->fileId->int()) {
+            $fileId = $input->fileId->int();
+        } else {
+            $fileId = false;
+        }
+
         if (! empty($input->asArray('user')) && is_array($input->user->asArray())) {
             $asuser = $input->asArray('user')[0];
         }


=====================================
templates/api/docs/paths/galleries/upload.yaml
=====================================
@@ -13,6 +13,9 @@ post:
             galleryId:
               type: integer
               description: The gallery ID where the file will be uploaded
+            fileId:
+              type: integer
+              description: The file ID to update. Provide this to upload a new version and replace the current file. If omitted, a new file will be created instead.
             data:
               type: file
               description: file path to upload



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/865d07167f135ab25c1390ed27f2e3e7bd401bd4

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/865d07167f135ab25c1390ed27f2e3e7bd401bd4
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.