> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/huong-dan-cac-action/keyboard/file-upload.md).

# File upload

File upload là hành động ra lệnh cho trình duyệt tự động đẩy một hoặc nhiều tệp tin (hình ảnh, video, tài liệu Excel, txt...) từ máy tính của bạn lên máy chủ của trang web mục tiêu.

🎥 Xem thêm video hướng dẫn: [Tại đây](https://youtu.be/cCTEtuMtz-s).

#### Tham số cấu hình:

* XPath: Đường dẫn mã định danh (XPath) dẫn thẳng tới khung nạp tệp tin của trang web.

  > ⚠️ Chú ý quan trọng: Khi thực hiện tự động hóa bằng mã lệnh, bạn không click trực tiếp vào các nút có chữ "Chọn ảnh" hay "Tải ảnh lên" (vì nó sẽ mở ra cửa sổ chọn file của hệ điều hành Windows/macOS làm đơ kịch bản). Thay vào đó, bạn phải tìm đúng thẻ ẩn có cấu trúc dạng: `//input[@type='file']` trên trang web để điền XPath vào ô này.
* File path: Đường dẫn tuyệt đối dẫn tới tệp tin đang lưu trên máy tính của bạn (Ví dụ: `C:\Users\Admin\Desktop\avatar.png`). Bạn có thể truyền biến chứa đường dẫn động vào đây (Ví dụ: `$filePath`).

#### Ví dụ thực tế: Tải ảnh sản phẩm lên hệ thống

Khi bạn làm kịch bản đăng bài bán hàng (Listing sản phẩm) tự động lên các sàn thương mại điện tử hoặc mạng xã hội, luồng xử lý chuẩn sẽ như sau:

* Cách cấu hình:
  * Element XPath: `//input[@type='file' and @name='product_image']` (Quét mã nguồn trang web để tìm thẻ input ẩn này).
  * File path: `D:\DataPOD\Design01.png`
* Logic vận hành: GPM Automate sẽ truyền trực tiếp đường dẫn file `D:\DataPOD\Design01.png` vào thẳng phần tử `input` của trang web. Hệ thống của website sẽ ngay lập tức nhận diện và bắt đầu quá trình tải ảnh lên một cách mượt mà mà không hề làm xuất hiện hộp thoại Open File của hệ điều hành.

<figure><img src="/files/Ishl4KPMXqcrGo3FZi4m" alt=""><figcaption></figcaption></figure>


---

# 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://docs.gpmautomate.com/huong-dan-cac-action/keyboard/file-upload.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.
