> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJkZmUxMGMwMy03NTg3LTQ1MzAtYWU4ZS02NzQzOTMyZmYxZjgiLCJleHAiOjE3ODA2NjI2MjgsImlhdCI6MTc4MDY2MjMyOH0.aHrDH15XVUWZgNfPWWa7bVMi0_hX5QsKgXYM14HEGdQ
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 多部分文件上传

> 文档化具有 `multiform` 内容类型的端点。

Fern 中的端点定义在 `endpoints` 键下。如果您的端点请求包含文件上传，您可以使用 `file` 类型来指示请求是 `multiform` 内容类型。下面的示例演示了一个在请求体中包含文件的端点。

```yaml {12}
service:
  base-path: /documents
  auth: false
  endpoints:
    uploadDocument:
      path: /upload
      method: POST
      request:
        name: UploadDocumentRequest
        body:
          properties:
            file: file
```

在给定的多部分请求中，带有 `format:binary` 的字符串参数将表示任意文件。

## 文件列表

如果您的端点支持文件列表，那么您的请求体必须指明这一点。

```yaml {12}
service:
  base-path: /documents
  auth: false
  endpoints:
    uploadDocuments:
      path: /upload
      method: POST
      request:
        name: UploadDocumentsRequest
        body:
          properties:
            files: list<file>
```