> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/creating-content/blocks/insert-files.md).

# 文件

你可以将文件上传到你的 GitBook 区块，并将它们添加到页面中，供人们查看或下载。

你可以将某些文件（例如图片和 OpenAPI 文件）直接显示在页面上，供人们无需点击任何内容即可查看。对于其他文件，例如 PDF，用户需要点击才能查看或下载。

如果需要，你还可以选择在插入页面的任何文件下方添加说明文字，以提供更多信息。

### 文件示例 <a href="#example-of-a-file" id="example-of-a-file"></a>

{% file src="/files/8baa695d9855e2732e0d9da5d1d738fce6871f61" %}
这是文件上的说明文字。
{% endfile %}

### 上传文件

你可以在以下位置管理已上传的文件： **资源库** 选项卡。 **资源库** 选项卡位于 **页面** 的左侧导航顶部旁边。

要上传文件，请将其拖放到 **拖放你的文件或浏览** 区域，或选中它并使用系统文件对话框选择你要上传的文件。

{% hint style="warning" %}
GitBook 允许你每个文件上传最大 100MB 的文件。
{% endhint %}

当你添加图片区块或 OpenAPI 区块时，也可以将文件添加到页面中。创建这些区块之一时， **资源库** 选项卡会打开，因此你可以选择一个文件，或者上传一个新文件。

{% hint style="info" %}
**提示：** 你还可以直接从文件系统中将图片拖放到编辑器中，或将复制的图片粘贴到内容中。GitBook 会自动将它们添加到相应区块的 **资源库** 选项卡中，因此你以后可以查看和管理它们。
{% endhint %}

### 重命名文件

要重命名文件，请打开该文件的 **操作菜单** <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="/files/d05670ba93b683794fb3fe95a9fc7ab5c7fceafd" alt="The Actions menu icon in GitBook"></picture> ，然后点击 **编辑**。在对话框提示中，输入文件的新名称。

### 删除文件

要删除文件，请打开该文件的 **操作菜单** <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="/files/d05670ba93b683794fb3fe95a9fc7ab5c7fceafd" alt="The Actions menu icon in GitBook"></picture> 并点击 **删除**。在对话框中确认你确定要删除该文件后，文件将被删除。

{% hint style="warning" %}
**注意：** 请确保更新任何包含已删除文件的页面！引用已删除文件的文件区块将显示为空白区块，或 *无法加载图片* 错误。
{% endhint %}

### 替换文件

如果某个文件只是需要更新为新版本，你可以替换它。这会用新文件替换旧文件。之前引用旧文件的任何区块随后都将引用新文件。

要替换文件，请打开 **操作菜单** <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="/files/d05670ba93b683794fb3fe95a9fc7ab5c7fceafd" alt="The Actions menu icon in GitBook"></picture> 并点击 **替换**。在出现的文件替换对话框中，选择新文件并等待上传指示完成。你的文件会自动在其出现在你的区段中的所有位置更新。

例如，如果你经历了一次重大的产品重新设计，并且需要更新出现在多个页面上的过时 UI 截图，这会很有帮助。替换原始文件将更新你区段中所有位置的截图，为你节省时间和精力。

{% hint style="info" %}
**提示：** 一旦你上传了图片或文件，就可以通过创建图片或文件区块并从 **资源库** 选项卡中选择它，在你的区段中的任何位置引用它。

我们建议你这样做，而不是每次需要包含它时都重新上传图片，这样以后替换图片会更容易，也可以避免出现多个同名文件。
{% endhint %}

### Markdown 中的表示

```markdown
{% file src="https://example.com/example.pdf" %}
    这是示例文件的说明文字。
{% endfile %}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/creating-content/blocks/insert-files.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
