> ## 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

> يفتح Windows file-open dialog عبر Windows file picker ويعيد الملف المحدد كـ file item.

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

  ## الوسائط

  <ParamField path={"options"} type={"DialogOptions"}>
    Optional table. في openfiledialog يتم استخدام title و defaultPath و extensionFilter. extensionFilter هي table من extension strings؛ يتم حذف . او \*. من البداية قبل ان يصبح كل filter بالشكل \*.\<extension>.
  </ParamField>

  ## القيم الراجعة

  <ResponseField name={"file"} type={"FileSystemItem | nil"}>
    Selected file item، او nil عندما يتم cancel للـ dialog او لا يتم ارجاع selected filesystem path. Dialog failures ترمي Failed to open file dialog.
  </ResponseField>

  ## الأنواع

  ### DialogOptions

  تكوين مربع حوار اختيار الملف أو المجلد الأصلي.

  | Name               | Type                 | Required | الوصف                                                                     |
  | ------------------ | -------------------- | -------- | ------------------------------------------------------------------------- |
  | `title`            | `string`             | No       | يضبط عنوان نافذة الحوار.                                                  |
  | `defaultPath`      | `string`             | No       | يحدد الدليل الذي يظهر عند فتح مربع الحوار.                                |
  | `extensionFilter`  | `&#123;string&#125;` | No       | يحد الملفات القابلة للتحديد من الامتدادات المدرجة، مع أو بدون نقطة بادئة. |
  | `suggestedName`    | `string`             | No       | يوفر اسم الملف الأولي في مربعات حوار الحفظ.                               |
  | `defaultExtension` | `string`             | No       | يضبط الامتداد المستخدم عندما لا يكون اسم الملف الذي تم إدخاله خاليًا.     |

  ## مثال

  افتح file picker وتعامل مع selected file item او 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>
