# How to receive images and files from a user

This section explains how to detect when a user sends a file, obtain its link, and how to work with it correctly.

To identify when a user has sent an attachment (such as an image, file, video, or audio), you must use the trigger condition:

`attachment_message`

<div data-with-frame="true"><figure><img src="/files/BmGvCrGaTNx180PNCc8q" alt=""><figcaption></figcaption></figure></div>

After a user sends a file, the following system variables are generated:

* `#{attachments}`: Contains the URLs of all attachments from the user's message, formatted as a JSON array. Use this when you need to process multiple files or handle the data structure programmatically.
* `#{attachment_url}`: Contains a direct, plain-text URL to the first (or only) attachment. This is the most convenient variable for immediate use, such as displaying the link in a message or passing it to another function.

To understand the practical difference, you can display both variables in a bot message. The `#{attachments}` variable will show a structured JSON array, while `#{attachment_url}` will show a simple, clickable URL.

<div data-with-frame="true"><figure><img src="/files/5WBM5BQYpDaFIVQzPLN7" alt=""><figcaption></figcaption></figure></div>

If your project handles multiple user attachments, it is efficient to assign each attachment URL to a dedicated variable.

To do this, declare a new variable in the block editor's **Calculator** and assign the `#{attachment_url}` value to it.

**Example:**\
`user_file = #{attachment_url}`&#x20;

<div data-with-frame="true"><figure><img src="/files/6dYG1CL7xdFu8mTNSSRL" alt="" width="563"><figcaption></figcaption></figure></div>

Assign the value of `attachment_url` to the variable `url_image1`.


---

# Agent Instructions: 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:

```
GET https://docs.mavibot.ai/chatbot/builder/attachments/images.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
