> ## 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 picker를 통해 Windows file-open dialog를 열고 선택한 파일을 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는 extension strings의 table입니다. 각 filter가 \*.\<extension>이 되기 전에 앞의 . 또는 \*.가 제거됩니다.
  </ParamField>

  ## 반환값

  <ResponseField name={"file"} type={"FileSystemItem | nil"}>
    Selected file item 또는 dialog가 취소되거나 selected filesystem path가 반환되지 않을 때 nil입니다. Dialog failures는 Failed to open file dialog를 throw합니다.
  </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>
