From 64a0f24e556a7fed6a235176bedbe96f5f5cae6e Mon Sep 17 00:00:00 2001 From: Jonathan Martz Date: Mon, 9 Oct 2023 20:16:19 +0200 Subject: [PATCH] update docs for upload --- README.md | 3 +++ src/Collection.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d8f3755..d1b8eca 100644 --- a/README.md +++ b/README.md @@ -39,4 +39,7 @@ $pb->collection(collectionIdOrName)->update(string $recordId, array $bodyParams // Deletes a single record by its id. $pb->collection(collectionIdOrName)->delete(string $recordId, array $queryParams = []); + +// Custom Logic +$pb->collection(collectionIdOrName)->upload('abcdefghijkl','webp', './converted/filepath.png'); ``` diff --git a/src/Collection.php b/src/Collection.php index 69db14c..6eefc95 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -55,7 +55,7 @@ class Collection */ public function upload(string $recordId, string $field, string $filepath): void { - $ch = curl_init($this->url . "/api/collections/gallery_media/records/" . $recordId); + $ch = curl_init($this->url . "/api/collections/".$this->collection."/records/" . $recordId); curl_setopt_array($ch, array( CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_POSTFIELDS => array(