Skip to content

TWebOpenDialog

Description

The TWebOpenDialog non-visual component allows to start a dialog to pick files from the local file system.

Sample code using a promise to get the selected filename after opening:

var
 fn: string;
begin
 fn := await(string, WebOpenDialog1.Perform);
 ShowMessage(fn);
end;

Properties for TWebOpenDialog

Property Description
Accept Sets an optional file filter. This is a string containing the extensions of files that can be selected. Note that setting the file filter will not prevent that the user can pick other filenames. To select only text files (*.txt), set Accept to ‘.txt’. To select JPEG, GIF, PNG image files , set Accept to ‘.jpg,.jpeg,.png,.gif’ or it could also be set to: ‘image/*’.
FileName This returns the name of the local file picked
Files This is a list of files picked. The list consists of objects of the TFile type.
Multifile When true, it is allowed to pick or drag multiple files.

Methods for TWebOpenDialog

Method Description
Execute Starts the dialog for picking a local file
Execute(AProc: TOpenDialogProc); Starts the dialog for picking a local file with anonymous handler called when a file is selected
Perform: TJSPromise Async version to show the open dialog, returns the selected filename

Events for TWebOpenDialog

Event Description
OnChange Event triggered when the file(s) picked changed by the user.