elFinder Documentation

repository·master·Indexed 26 days ago

https://github.com/studio-42/elfinder

An open-source, web-based file manager inspired by MacOS Finder. It provides a mobile-friendly interface for managing files on remote servers with support for local filesystems, FTP, SFTP, and cloud services including S3, Dropbox, Google Drive, OneDrive, Azure, and Digital Ocean Spaces. Built for PHP 5.2+ and requiring jQuery 1.8.0+ and jQuery UI 1.9.0+, it features a JSON-based client-server API, background chunked uploads, and archive creation/extraction.

Tokens
15.5K
Snippets
2
Records
96
Agent score
88%

What's inside elFinder

  1. elFinder features overview

    master

    elFinder provides a web-based file manager with the following capabilities:

    • Usability: MacOS Finder or Windows Explorer style interface.
    • Mobile: Touch-friendly view.
    • Remote Operations: Copy, move, upload, create folder/file, rename, etc.
    • Storage Drivers: Local file system, MySQL, FTP, SFTP, Box, Dropbox, GoogleDrive, and OneDrive.
    • Cloud Support: AWS S3, Azure, Digital Ocean Spaces via League\Flysystem driver.
    • File Handling: Background uploads (HTML5 Drag & Drop), chunked uploads for large files, and archive creation/extraction (zip, rar, 7z, tar, gzip, bzip2).
    • UI/UX: List and Icons views, keyboard shortcuts, drag & drop, and rich context menus.
    • Extensibility: Simple client-server API based on JSON and event handling for both backend and client side.
  2. Install elFinder from source

    master

    For development and debugging, clone the repository directly to your PHP server:

    1. Clone the repository:
      $ git clone https://github.com/Studio-42/elFinder.git
    2. Rename /php/connector.minimal.php-dist to /php/connector.minimal.php.
    3. Load /elfinder.src.html in your browser to run elFinder.
    $ git clone https://github.com/Studio-42/elFinder.git
  3. Install elFinder using compressed builds

    master

    To set up elFinder for production, use the compressed builds:

    1. Download and unzip one of the builds to your PHP server.
    2. Rename /php/connector.minimal.php-dist to /php/connector.minimal.php.
    3. Load /elfinder.html in your browser to run elFinder.
  4. Use the paste command in elFinder

    master

    The paste command allows you to paste files or directories from the elFinder clipboard into a target directory.

    Behavior

    • Move vs Copy: If the files in the clipboard were originally 'cut' (moved), the command performs a move. If they were 'copied', it performs a copy.
    • Targeting: If a selection is provided, the files are pasted into the selected item (which must be a directory). If no selection is provided, they are pasted into the current working directory (cwd).
    • Duplicates: If files are pasted into their own parent directory, elFinder creates duplicates to avoid conflicts.
    • Conflicts: If copyOverwrite is enabled and files already exist in the destination, elFinder will prompt the user to either replace the existing files or rename the incoming files (backup).

    Keyboard Shortcut

    • ctrl+v shift+insert
  5. Rename files or folders in elFinder

    master

    The rename command allows you to change the name of a single file/folder or perform batch renaming on multiple selected items.

    Single Rename

    When a single file is selected, elFinder provides an inline input field (or textarea for long names) to edit the name.

    • Validation: The new name is validated against fm.options.validName. It cannot be empty (unless renaming a root item), ., .., or a name that already exists in the same directory.
    • Root Renaming: Renaming root items is supported if fm.options.enableRootRename is not set to false.

    Batch Rename

    When multiple files are selected, you can trigger a batch rename dialog. This allows you to apply a pattern to all selected files using several modes:

    • plusNumber: Appends a number to the name.
    • asPrefix: Adds a prefix to the name.
    • asSuffix: Adds a suffix to the name.
    • changeExtention: Changes the file extension.

    Shortcuts

    • Single Rename: f2 (or f2 + enter on macOS).
    • Batch Rename: shift+f2 (only works when more than one file is selected).
  6. Enable the debug tab in the help dialog

    master

    The debug tab is available if the debug option is set to true in the elFinder configuration and the project has jQuery UI Tabs installed.

    When a backenddebug event is triggered with debug data, the help dialog can display detailed information about the current command's options and debug state. This is useful for inspecting the internal state of elFinder during development.

  7. Use the quicklook command for fast file previews

    master

    The quicklook command provides a fast preview window for various file types within elFinder. It supports viewing file details, thumbnails, and media playback (audio/video) depending on browser support.

    Key Features

    • Fast Preview: Quickly view file metadata (name, mime type, size, modification date) and thumbnails.
    • Media Support: Built-in support for audio (ogg, webm, mp3, wav, m4a, flac, amr) and video (ogg, webm, mp4, mkv, 3gp, m3u8, mpd) formats.
    • Window Modes:
      • Standard: A floating, draggable, and resizable window.
      • Fullscreen: Expands the preview to fill the available space.
      • Docked: Docks the preview into the elFinder navdock area.
    • Keyboard Shortcuts: Trigger the command using the space key.
    • Navigation: Use left/right arrow keys to navigate between files while the preview is open.

    Configuration Options

    When initializing the command, you can provide the following options:

    • width: The width of the opened window (default: 450).
    • height: The height of the opened window (default: 300).
    • dockHeight: The height of the docked window (default: 'auto').
    • autoplay: Boolean to enable/disable autoplay for media.
    • dockAutoplay: Boolean to enable/disable autoplay when docked.
    • docked: Initial docking state (retrieved from fm.storage('previewDocked')).
    • mimeRegexNotEmptyCheck: Regex used to check if a file should be previewed based on size/mime.
  8. Resize, Crop, and Rotate images in elFinder

    master

    The elFinder resize command provides a dialog interface for manipulating images. Depending on the available API version and file type, users can perform the following operations:

    • Resize: Adjust width and height, apply presets, and control JPEG quality.
    • Crop: Define specific X/Y coordinates and dimensions for cropping.
    • Rotate: Rotate the image by degrees (including 90/270 degree increments) and set a background color.

    Key Features:

    • Presets: Quick application of predefined dimensions.
    • Quality Control: Adjust JPEG compression levels.
    • 8px Grid: Support for 8px grid alignment (specifically for JPEGs).
    • Save vs Save As: If the server supports it, users can choose to overwrite the original file or save the result as a new file.
    • Visual Preview: Real-time preview of changes within a dialog window.
  9. Configure archive formats via archivers option

    master

    Archive behavior is controlled by the archivers configuration object.

    • archivers.create: An array of MIME types that are supported for creating new archives (e.g., ['application/zip', 'application/x-tar']).
    • archivers.createext: A mapping object that defines the file extension to use for a specific MIME type (e.g., { 'application/zip': 'zip' }).

    When creating an archive, the filename is generated as follows:

    • If multiple files are selected: Archive.[extension]
    • If a single file is selected: [filename].[extension]
  10. Configure the help content source via `helpSource`

    master

    The help command can load external HTML content for the "Help" tab. By default, it attempts to fetch content from fm.i18nBaseUrl + 'help/{lang}.html.js'. If the language-specific file is not found, it falls back to the English version (en).

    You can override this behavior by providing a custom URL in the helpSource option.

  11. Hide specific information fields in the 'info' dialog

    master

    To reduce clutter in the information dialog, you can prevent specific fields from being displayed using the hideItems option. This option accepts an object where keys correspond to the field names and values are booleans.

    Supported keys for hiding:

    • size
    • aleasfor (Alias for)
    • path
    • link
    • dim (Dimensions)
    • modify (Modification date)
    • perms (Permissions)
    • locked
    • owner
    • group
    • perm (File mode)
    • Custom labels defined in options.custom

    Example Configuration:

    // Example of hiding size and path in the info dialog
    options: {
      hideItems: {
        size: true,
        path: true
      }
    }