# كيفية استقبال الصور والملفات من المستخدم

يشرح هذا القسم كيفية اكتشاف متى يرسل المستخدم ملفًا، والحصول على رابطه، وكيفية التعامل معه بشكل صحيح.

لتحديد متى أرسل المستخدم مرفقًا (مثل صورة أو ملف أو فيديو أو صوت)، يجب استخدام شرط التشغيل التالي:

`attachment_message`

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

بعد أن يرسل المستخدم ملفًا، يتم إنشاء متغيرات النظام التالية:

* `#{attachments}`: يحتوي على عناوين URL لجميع المرفقات من رسالة المستخدم، بتنسيق مصفوفة JSON. استخدم هذا عندما تحتاج إلى معالجة عدة ملفات أو التعامل مع بنية البيانات برمجيًا.
* `#{attachment_url}`: يحتوي على عنوان URL مباشر ونصي بسيط للمرفق الأول (أو الوحيد). هذا هو المتغير الأكثر ملاءمة للاستخدام الفوري، مثل عرض الرابط في رسالة أو تمريره إلى دالة أخرى.

لفهم الفرق العملي، يمكنك عرض كلا المتغيرين في رسالة من الروبوت. الـ `#{attachments}` المتغير سيعرض مصفوفة JSON منظمة، بينما `#{attachment_url}` سيعرض عنوان URL بسيطًا يمكن النقر عليه.

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

إذا كان مشروعك يتعامل مع عدة مرفقات من المستخدم، فمن الفعّال تعيين عنوان URL لكل مرفق إلى متغير مخصص.

للقيام بذلك، أنشئ متغيرًا جديدًا في **الحاسبة** لمحرر الكتل، ثم عيّن `#{attachment_url}` القيمة إليه.

**مثال:**\
`user_file = #{attachment_url}`&#x20;

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

عيّن قيمة `attachment_url` إلى المتغير `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/doc/ar/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.
