> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 文件

> 使用 PHP SDK 上传文件、查看元数据并获取文件内容。

**方法**：`uploadFile()`、`listFiles()`、`retrieveFile()`、`retrieveFileContent()`

### 示例

```php theme={null}
<?php

require 'vendor/autoload.php';

use Phaseo\Sdk\Phaseo;

$apiKey = getenv('PHASEO_API_KEY');
$client = new Phaseo(apiKey: $apiKey);

$uploaded = $client->uploadFile([
    'purpose' => 'batch',
    'file' => 'data:application/json;base64,eyJ0ZXN0Ijp0cnVlfQ==',
]);

$file = $client->retrieveFile('file_123');
$content = $client->retrieveFileContent('file_123');
```

<Note>
  `listFiles()` 已接入 SDK，但使用共享网关密钥时，`GET /files` 当前会返回 `file_list_not_supported_with_shared_gateway_key`
  保存已上传文件的 ID，并直接获取文件。
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.