> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# openfiledialog

> Mo Windows file-open dialog qua Windows file picker va tra ve file da chon duoi dang file item.

<div className="real-function-page">
  ```lua theme={null}
  openfiledialog(options?: DialogOptions): FileSystemItem | nil
  ```

  ## Đối số

  <ParamField path={"options"} type={"DialogOptions"}>
    Optional table. Voi openfiledialog, title, defaultPath va extensionFilter duoc dung. extensionFilter la table gom extension strings; . hoac \*. o dau duoc xoa truoc khi moi filter thanh \*.\<extension>.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"file"} type={"FileSystemItem | nil"}>
    Selected file item, hoac nil khi dialog bi cancel hoac khong co selected filesystem path duoc tra ve. Dialog failures throw Failed to open file dialog.
  </ResponseField>

  ## Kiểu

  ### DialogOptions

  Định cấu hình hộp thoại chọn tệp hoặc thư mục gốc.

  | Name               | Type                 | Required | Mô tả                                                                                              |
  | ------------------ | -------------------- | -------- | -------------------------------------------------------------------------------------------------- |
  | `title`            | `string`             | No       | Đặt tiêu đề cửa sổ hộp thoại.                                                                      |
  | `defaultPath`      | `string`             | No       | Chọn thư mục hiển thị khi hộp thoại mở ra.                                                         |
  | `extensionFilter`  | `&#123;string&#125;` | No       | Giới hạn các tệp có thể chọn ở các tiện ích mở rộng được liệt kê, có hoặc không có dấu chấm ở đầu. |
  | `suggestedName`    | `string`             | No       | Cung cấp tên tệp ban đầu trong hộp thoại lưu.                                                      |
  | `defaultExtension` | `string`             | No       | Đặt phần mở rộng được sử dụng khi tên tệp đã nhập không có.                                        |

  ## Ví dụ

  Mo file picker va xu ly selected file item hoac cancellation.

  ```lua theme={null}
  local file = openfiledialog({
      title = "Choose a configuration",
      defaultPath = ".",
      extensionFilter = { "json", "txt" },
  })

  if file then
      print(file:GetName())
      print(file:IsFile())
  else
      print("No file selected")
  end
  ```
</div>
