Open file manager
Flmngr.open
Opens the file manager dialog to allow the user to select or manage files.
By setting isMultiple
parameter, you can open a dialog for picking different numbers of files or images (or just open a manager without the ability to return any file).
You can pass preselected files using the parameter list
and limit file extensions with acceptExtensions
.
Code samples:
Parameters
-
...common parameters
:{ any parameters ofFlmngr.load()
method }All parameters that you can pass to the
Flmngr.load({params})
method are also available here. So you can override some values (exceptapiKey
) or pass parameters that are missing in theFlmngr.load()
call but are required for this method, such asurlFiles
andurlFileManager
. -
list
:string[] | nullAn URL or a list of URLs that need to be preselected when the file manager opens.
If you omit this parameter or pass
null
, the file picker will open with no file selected. But if you wish to allow the user to edit their previous file selection, please specify this parameter.Each URL must start with
urlFiles
in the path (they need to exist in your storage).Not applicable when
isMultiple
is set tonull
(when the file manager does not expect any file to be picked).Default is
null
(no preselected file) Optional -
dir
:stringA directory to open when the dialog is shown.
Basically the file manager opens a root directory, and when some files are already preselected, the directory containing them is used. This parameter can override such behavior and open exact folder that you specify.
The rule for constructing the value for this parameter: if you have some directory shown inside the file manager tree as
/files/my-folder/sub-folder
, just specifymy-folder/sub-folder
as the value. -
acceptExtensions
:string[] | nullA list of exceptions to accept when the user picks some files or a file. This will also filter out all other files and images from the file view.
For example, you can limit picking only images by setting the value to
["png", "jpg", "jpeg", "webp"]
or if you wish to let the user select only PDF files:["pdf"]
.Not applicable when
isMultiple
is set tonull
(when the file manager does not expect any file to be picked).Default is
null
(any file extension is accepted) Optional -
Defines how many files you wish this dialog to return.
Default is
false
Optional-
false
Opens the file manager to select a single file or image.
-
true
Opens the file manager to select multiple files or images.
-
null
Opens the file manager just to manage the file system without the ability to pick anything.
-
-
isMaximized
:booleanControls an initial file manager dialog state: maximized window or a dialog.
Default is
false
(dialog) Optional -
showMaximizeButton
:booleanShow or hide maximize/minimize button.
Default is
true
Optional -
showCloseButton
:booleanShow or hide close button.
You can set it to
false
if wish to disable the close dialog (cancel) feature.Default is
true
Optional -
allowReorder
:booleanYou can enable or disable the reordering of picked files when the file manager is opened with
isMultiple
set totrue
.Flmngr file manager always passes a list of files and images picked by the user into the
onFinish
listener, ordered as the files were shown in the pick area of the dialog.Default is
true
Optional -
createImageFormats
:string[]A list of image format IDs to retrieve. You can set IDs specified in
imageFormats
here, so when theonFinish
listener is called, you automatically receive the URLs of generated previews of selected images.For example, you can generate small and medium previews (assuming the
imageFormats
parameter hasn't changed) by setting the value to["preview", "medium"]
.Default is
null
(get only original images) Optional -
How many levels of directories to expand on start.
Default is
99
. Optional-
1
Show only immediate child folders of the root directory.
-
2
Show both immediate child folders and their subfolders of the root directory.
-
...
etc.
-
-
How Flmngr should order directories in the directory tree.
Default is
none
. Optional-
none
No sorting; the list will be displayed as received. Sometimes the server can return the list in alphabetic order, sometimes not. This can depend on your server file system and Flmngr will not guarantee any exact behaviour here.
-
alphabetical
Flmngr will sort directories in strict alphabetical order like:
dir-a dir-b dir-c-1 dir-c-11 dir-c-2
-
natural
Natural (human) sorting is similar to
alphabetical
sorting but respects numeration:dir-a dir-b dir-c-1 dir-c-2 dir-c-11
-
-
Flmngr can avoid loading the entire directory tree at once and load it directory by directory when the user clicks on them.
Default is
false
. Optional -
Initial file sorting type.
Default is
"name"
. Optional-
"name"
Sort by filename
-
"size"
Sort by file size (bytes)
-
"date"
Sort by file timestamp
-
-
Initial file sorting direction.
Default is
true
. Optional-
true
Ascending order
-
true
Descending order
-
-
Premium Flmngr users can remove the Flmngr logo.
Default is
false
. Optional -
onFinish
:() => { files: { url: string, formats: { format: string, url: string }[] }[] }A callback to receive a file list specified by the user.
Each file has a URL but also (if required by the
createImageFormats
parameter) will contain aformats
array with a set of required formats, where theformat
field of each image variant will contain an ID of the requested format.Optional Default is
null
, but you should set a callback if expect some file will be picked by the user. -
onCancel
:() => {}A callback to handle a moment when the user closed the dialog without picking a file.
Default is
null
Optional