Open the 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 asurlFilesandurlFileManager. -
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
urlFilesin the path (they need to exist in your storage).Not applicable when
isMultipleis set tonull(when the file manager does not expect any file to be picked).Optional Default is
null(no preselected file). -
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-folderas 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
isMultipleis set tonull(when the file manager does not expect any file to be picked).Optional Default is
null(any file extension is accepted). -
el:HTMLElement | nullIf set, the file manager will be mounted as a panel component instead of showing a dialog (dialog is default behavior).
For example, this paramter is used when you attach React file manager component to your DOM tree.
Please prefer calling
mount()method instead ofopen()one with explicit passing HTML element as a first parameter.Optional Default is
null -
Defines how many files you wish this dialog to return.
Optional Default is
falseDefault will be overriden to
nullif you call amount()method instead ofopen().-
falseOpens the file manager to select a single file or image.
-
trueOpens the file manager to select multiple files or images.
-
nullOpens the file manager just to manage the file system without the ability to pick anything.
-
-
Defines a caption of the dialog title.
Optional Default is
Flmngr file manager -
isMaximized:booleanControls an initial file manager dialog state: maximized window or a dialog.
Optional Default is
false(dialog). -
showMaximizeButton:booleanShow or hide maximize/minimize button.
Optional Default is
true -
showCloseButton:booleanShow or hide close button.
You can set it to
falseif wish to disable the close dialog (cancel) feature.Optional Default is
true -
allowReorder:booleanYou can enable or disable the reordering of picked files when the file manager is opened with
isMultipleset totrue.Flmngr file manager always passes a list of files and images picked by the user into the
onFinishlistener, ordered as the files were shown in the pick area of the dialog.Optional Default is
true -
createImageFormats:string[]A list of image format IDs to retrieve. You can set IDs specified in
imageFormatshere, so when theonFinishlistener is called, you automatically receive the URLs of generated previews of selected images.For example, you can generate small and medium previews (assuming the
imageFormatsparameter hasn't changed) by setting the value to["preview", "medium"].Optional Default is
null(get only original images). -
How many levels of directories to expand on start.
Optional Default is
99-
1Show only immediate child folders of the root directory.
-
2Show both immediate child folders and their subfolders of the root directory.
-
...
etc.
-
-
How Flmngr should order directories in the directory tree.
Optional Default is
none-
noneNo 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.
-
alphabeticalFlmngr will sort directories in strict alphabetical order like:
dir-a dir-b dir-c-1 dir-c-11 dir-c-2 -
naturalNatural (human) sorting is similar to
alphabeticalsorting 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.
Optional Default is
false -
Initial file sorting type.
Optional Default is
"name"-
"name"Sort by filename
-
"size"Sort by file size (bytes)
-
"date"Sort by file timestamp
-
-
Initial file sorting direction.
Optional Default is
true-
trueAscending order
-
falseDescending order
-
-
Premium Flmngr users can remove the Flmngr logo.
Optional Default is
false -
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
createImageFormatsparameter) will contain aformatsarray with a set of required formats, where theformatfield 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.
Optional Default is
null