Preload the file manager
Flmngr.load
Loads the libraries of the file manager from CDN and optionally preconfigures it with some parameters.
It is recommended to run this method right when the page loads to avoid loading delays. If you do not do it, Flmngr will be loaded on the first call, and you will need to pass all parameters of this function to another Flmngr method. This is applicable only for integrations based on the NPM package. In other configurations, do not use this function; simply call the desired method as usual.
Manually call Flmngr.load()
Integrations:
Call the Flmngr.load()
method when the page loads. If you don't do that, please pass the same parameters in the desired method merged with its parameters (the user will wait until Flmngr is loaded in this case).
No need to call Flmngr.load()
Integrations:
- JS snippet ***
- CKEditor 4 plugin
- CKEditor 5 plugin
- TinyMCE plugin
- Froala plugin
- Drupal 8 module
- Drupal 9 module
- Drupal 10 module
All these integrations will preload Flmngr with an API key specified in another place.
*** JS snippet integration loads Flmngr with your API key but does not configure it. So you will need to pass at least urlFiles
and urlFileManager
to every method you call, for example, to Flmngr.open({params})
.
Parameters
-
apiKey
:stringYour API key or
FLMN24RR1234123412341234
if you are not registered yet.Do not pass this parameter when you use an integration that automatically loads Flmngr with a specific API key: JS snippet-based apps, CKEditor, TinyMCE, Drupal, Froala.
This parameter is only for NPM package-based integrations, such as direct usage of the NPM package in your app, React, Vue, etc. In such configurations, you can omit it if you have already passed an API key at least once in some Flmngr method, including
Flmmngr.load(apiKey)
which is recommended to call when the page loads.Do not mix different API keys in one application; only the first one will be used.
-
urlFiles
:stringCan be configured via DashboardPrefix for your files directory in URL notation. For example:
https://example.com/images/
In a multi-user environment, you can dynamically set this parameter depending on the current user logged into your app/CMS (don't forget to also set the directory on the server in the same way).
-
urlFileManager
:stringCan be configured via DashboardURL on your server that will serve all requests from Flmgnr. This is the URL where you have bound the Flmngr backend. For example:
https://example.com/scripts/flmngr.php
-
urlFileManager__CSRF
:( onSuccess: ( result: { headers?: {[key: string]: string}, params?: {[key: string]: string} } ) => void, onError: () => void ) => voidA callback to prepare the CSRF token if your app requires that.
This parameter must contain a callback that Flmngr will execute before any request to the server.
This callback should obtain the CSRF token from your app and pass it to the
onSuccess()
listener with POST parameters (params
field) or headers (headers
field). Flmngr will set such parameters and/or headers when sending the request.If there is an error while getting the CSRF token, call the
onError()
listener. Flmngr won't make any request in this case.If your app does not require a CSRF token, just omit this parameter.
Default is
null
Optional -
These two parameters can be used to set HTTP Basic Authentication credentials if your server uses such access checking.
Default is
null
for both parameters. Optional -
When using Amazon S3 or Azure Blob storage support, please specify your access key here. This allows you to avoid exposing the entire configuration when granting access to cloud storage for your users. Instead, you only need to expose the access key, which is linked to the credentials kept secret. The access key can be changed as needed.
Default is
null
. Optional -
Please specify the Unsplash API key as the value of this parameter in order to access 30,000+ free stock images from the file manager.
Default is
null
. Optional -
isMaximized
:booleanDefines whether the file manager dialog should be opened maximized or not.
Default is
false
. Optional -
showMaximizeButton
:booleanDefines whether the file manager dialog should show maximize button in the title or not. Set to
false
if you wish to prevent the user from maximizing the dialog.Default is
true
. Optional -
showCloseButton
:booleanDefines whether the file manager dialog should show a close button in the title or not. Set to
false
if you wish to prevent closing the dialog without picking a file.Default is
true
. Optional -
Setting this filter will hide certain files in the list. For example, you can filter out all
*.bmp
files.Default is
[".htaccess", ".htpasswd", ".gitignore"]
.Optional -
Setting this filter will hide certain directories in the tree. For example, you can filter out
.git
folders.The default is
[".cache", ".tmp", "tmp"]
.Optional -
defaultUploadDir
:stringCan be configured via DashboardDefines the default upload directory inside your storage. This parameter is not used when the file manager dialog is opened using
Flmngr.open({params})
because there is always a selected directory in that case. However, this parameter will be used when you callFlmngr.upload({params})
without thedirUploads
option.The path of this directory is relative to
urlFiles
(thedirFiles
option on the server).Default is
"/"
(root directory of your storage).Optional -
Defines a structure for uploads made outside of the Flmngr dialog, for example, when you press the "Upload" external button. All such uploaded files will be stored inside the
defaultUploadDir
directory.And these options allow you to change the type of folder structure inside the upload directory.
Default is
"flat"
.Optional-
"flat"
All files will be placed directly into the
defaultUploadDir
. -
YYYY/MM
The directory structure in the format
defaultUploadDir/year/month/
will be created (if it does not exist) to place uploaded files. -
YYYY/MM/DD
The directory structure in the format
defaultUploadDir/year/month/date/
will be created (if it does not exist) to place uploaded files. -
Please do not use any custom formats; only the values above are currently available.
-
-
uploadThreads
:numberWhen the user uploads bulk files, the Flmngr file manager will upload them simultaneously. This parameter defines the maximum number of simultaneous upload threads.
Default is
5
.Optional -
File manager displays files with automatic pagination, which is executed when users scroll through the file list until the end. This parameter defines how many files should be included on each page.
Default is
100
.Optional -
imageFormats
:{ id: string; title: string; suffix: string; maxWidth: number|null; maxHeight: number|null; }[]The
imageFormats
parameter defines how the Flmngr file manager should handle different image formats. For example, if you haveimage.png
andimage-preview.jpg
, the file manager will group them in the file list view if you have a format with the-preview
suffix. Deleting the original file will also delete its associated formats, and the same applies to renaming, moving, and other operations.Flmngr can also automatically create image formats when needed, for example when the user inserts an image as a preview. To do this you need to define this parameter and call
Flmngr.open({params})
with theFlmngr.createImageFormats({params})
parameter, which includes a set of image format IDs you need to obtain for the picked file.Similarly, you can programmatically request image formats for a specific image, and they will be created if they don't already exist. Please refer to the
Flmngr.createImageFormats({params})
method for more details on this functionality.Another feature is the ability to automatically resize the original image to be smaller than the
maxWidth
andmaxHeight
of thedefault
image format.Optional Default is:
[ { "id": "preview", "title": "Preview", "suffix": "-preview", "maxWidth": 480, "maxHeight": 480 }, { "id": "medium", "title": "Medium", "suffix": "-medium", "maxWidth": 1024, "maxHeight": 1024 }, { "id": "default", "title": "Default", "suffix": null, "maxWidth": 10000, "maxHeight": 10000 } ]