Download a File
Download a File to a temporarily file or a given directory or file.
Permissions Required
You must have permissions to read the field that the file was uploaded to for this request to succeed.
Method Signature
download(string $id, string $directory = null): SplFileObject
Parameters
Parameter | Type | Description |
---|---|---|
$id | string | The id of the File to download |
$directory | string | Optional The directory to save the download to. The file's original name will be preserved. Defaults to a local temporary directory. |
returns | SplFileObject | The downloaded File |
Example
<?php
/*
* This example demonstrates downloading a File
*/
require_once(__DIR__ . '/vendor/autoload.php');
use Catalytic\SDK\CatalyticClient;
$catalytic = new CatalyticClient();
$file = $catalytic->files()->download('924cd388-addb-42f7-913e-24c9beb17635');
echo "File downloaded to " . $file->getPathname() . PHP_EOL;
Updated almost 3 years ago