### File Manager

File Manager is a Gramex app used to upload, download, rename, delete and annotate files within a Gramex application.

#### Usage

FileManager can be imported in a Gramex app as follows:

      import:
        filemanager:
          path: $GRAMEXAPPS/filemanager/gramex.yaml
          YAMLURL: $YAMLURL/filemanager/

This mounts the FileManager page at `/filemanager/`. For each `DriveHandler` endpoint configured in your Gramex app, the FileManager page shows a FormHandler table of files stored in that drive. This table can be used to:

- Upload new files - Click the "Upload" button, or drop files anywhere on the table.
- Download files - Click any file under the "File" column to download it.
- Delete existing files - Click the cross for a file under the "Delete" column.
- Rename files - Click the "Edit" button, make changes to filenames, and click "Save".

#### FileManager Options

FileManager can be configured by using options under `FILEMANAGER_KWARGS` in `gramex.yaml` as follows:

      import:
        filemanager:
          path: $GRAMEXAPPS/filemanager/gramex.yaml
          YAMLURL: $YAMLURL/filemanager/
          FILEMANAGER_KWARGS:
            drives: ['drive1', 'drive2']              # Show only these drives in the FileManager page
            title: "MyAwesomeFileManager"             # Title of the FileManager page
            logo: $YAMLPATH/data/assets/gramener.png  # Logo for the FileManager page
            theme: ...                                # Bootstrap theme for the FileManager page.

### Drive Handler

DriveHandler allows uploading, downloading, renaming, deletion and annotation of files in a Gramex application.

#### Usage

Use DriveHandler in Gramex app as follows: {% include 'drivehandler-snippet.html' %} This endpoint is a FormHandler that allows:

- GET `?ext=.xlsx` - List Excel files (FormHandler interface)
- GET `?_format=file&id=2` - Download file with ID=2
- PUT `?id=3&file=abc.txt` - Rename file with ID=3 to abc.txt
- PUT `?id=3&mime=text/html&tag=x` - Set MIME type type and tag of ID=4
- DELETE ?id=4 - Delete file with ID=4
- POST ?tag=x&tag=y - Upload one or more files. Tag 1st file as x, 2nd as y

### Embedding FileManager

Just like FormHandler, the FileManager component can be embedded in any `<div>` element, as follows: {% include 'filemanager-snippet.html' %}