update docs for upload

This commit is contained in:
Jonathan Martz
2023-10-09 20:16:19 +02:00
parent bbe4857b34
commit 64a0f24e55
2 changed files with 4 additions and 1 deletions

View File

@@ -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');
```

View File

@@ -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(