Function “chooseFile”
function chooseFile([options])
Prompts the user to choose a file
The file chooser dialog can be customized with the following options:
save: Boolean specifying whether a file is chosen for saving or for openingdirectory: The directory to start in (path or URL)formats: An array of supported file formats - each entry consists of a name and an array of patterns (e.g. "*.txt")
Parameters
| Name | Type | Description |
|---|---|---|
options | any (optional) | An optional object specifying additional settings for the dialog |
Return Value
If the user has chosen a file, the URL of the chosen file is returned.
Example
file = chooseFile({
save: true,
formats: [
{name: "Plain Text", ["*.txt"]},
{name: "Rich Text", ["*.rtf"]}
]
});
if (file != "") {
// save file
}