openfilesdialog Asynchronous

Open the system file picker with multiple selection enabled. Use it to import a batch of user-selected documents. Iterate the returned handles to read or inspect each file, and handle cancellation before starting the loop.

Syntax
Luau
openfilesdialog(options: FileDialogOptions?) -> {Document}?

Parameters

Function parameters
ParameterTypeDescription
optionsFileDialogOptions?Optional picker settings. Field names are case sensitive; see the options fields below.

Argument fields

FileDialogOptions fields
Luau
FileDialogOptions = {
  defaultPath: string?, title: string?, extensionFilter: {string}?,
  suggestedName: string?, defaultExtension: string?
}
FieldDescription
defaultPathInitial picker location. The Android picker uses this only when it is a content:// URI.
titleOptional chooser title for open dialogs. It is not used as the save filename.
extensionFilterArray of extensions, such as {"txt", "json"}. Known extensions are converted to MIME filters; unknown-only filters allow all types. Folder dialogs do not use this filter.
suggestedNameSuggested filename for savefiledialog. Defaults to untitled when omitted or empty.
defaultExtensionExtension appended to the suggested save filename when it does not already have that extension. Leading dots are removed.

Returns

{Document}?

An array of Document handles for the selected files, or nil when the user cancels.

Usage notes

Document is a handle returned by a file dialog or a folder method. Call its methods with a colon, for example document:Read(). After Delete succeeds, that handle is invalid and further method calls raise an error.

Example

Example
Luau
local documents = openfilesdialog()
if documents then
    for _, document in ipairs(documents) do
        print(document:GetName())
    end
end
Kawaii documentation