# File Config Object Structure

## Overview

The `fileConfig` object allows you to configure file handling settings for the application, including size limits and MIME type restrictions. This section provides a detailed breakdown of the `fileConfig` object structure.

There are 3 main fields under `fileConfig`:

  - `endpoints`
  - `serverFileSizeLimit`
  - `avatarSizeLimit`

**Notes:**

- At the time of writing, the Assistants endpoint [supports filetypes from this list](https://platform.openai.com/docs/assistants/tools/supported-files).
- OpenAI, Azure OpenAI, Google, and Custom endpoints support files through the [RAG API.](../../rag_api.mdx)
- Any other endpoints not mentioned, like Plugins, do not support file uploads (yet).
- The Assistants endpoint has a defined endpoint value of `assistants`. All other endpoints use the defined value `default`
  - For non-assistants endpoints, you can adjust file settings for all of them under `default`
  - If you'd like to adjust settings for a specific endpoint, you can list their corresponding endpoint names:
    - `assistants`
        - does not use "default" as it has defined defaults separate from the others.
    - `openAI`
    - `azureOpenAI`
    - `google`
    - `YourCustomEndpointName`
- You can omit values, in which case, the app will use the default values as defined per endpoint type listed below.
- LibreChat counts 1 megabyte as follows: `1 x 1024 x 1024`

## Example

```yaml filename="fileConfig"
fileConfig:
  endpoints:
    assistants:
      fileLimit: 5
      fileSizeLimit: 10
      totalSizeLimit: 50
      supportedMimeTypes:
        - "image/.*"
        - "application/pdf"
    openAI:
      disabled: true
    default:
      totalSizeLimit: 20
    YourCustomEndpointName:
      fileLimit: 5
      fileSizeLimit: 1000
      supportedMimeTypes:
        - "image/.*"
  serverFileSizeLimit: 1000
  avatarSizeLimit: 2

```

## serverFileSizeLimit

<OptionTable
  options={[
    ['serverFileSizeLimit', 'Integer', 'The global maximum size for any file uploaded to the server, specified in megabytes (MB).', 'Acts as an overarching limit for file uploads across all endpoints, ensuring that no file exceeds this size server-wide.'],
  ]}
/>

```yaml filename="fileConfig / serverFileSizeLimit"
fileConfig:
  serverFileSizeLimit: 1000
```


## avatarSizeLimit

<OptionTable
options={[
['avatarSizeLimit', 'Integer', 'The maximum size allowed for avatar images, specified in megabytes (MB).', 'Specifically tailored for user avatar uploads, allowing for control over image sizes to maintain consistent quality and loading times.'],
]}
/>

```yaml filename="fileConfig / avatarSizeLimit"
fileConfig:
  avatarSizeLimit: 2
```

## endpoints

<OptionTable
  options={[
    ['endpoints', 'Record/Object', 'Configures file handling settings for individual endpoints, allowing customization per endpoint basis.', 'Specifies file handling configurations for individual endpoints, allowing customization per endpoint basis.'],
  ]}
/>

**Description:** Each object under endpoints is a record that can have the following settings:

### Overview

  - `disabled`
      - Whether file handling is disabled for the endpoint.
  - `fileLimit`
      - The maximum number of files allowed per upload request.
  - `fileSizeLimit`
      - The maximum size for a single file. In units of MB (e.g. use `20` for 20 megabytes)
  - `totalSizeLimit`
      - The total maximum size for all files in a single request. In units of MB (e.g. use `20` for 20 megabytes)
  - `supportedMimeTypes`
      - A list of [Regular Expressions](https://en.wikipedia.org/wiki/Regular_expression) specifying what MIME types are allowed for upload. This can be customized to restrict file types.

## disabled

<OptionTable
  options={[
    ['disabled', 'Boolean', 'Indicates whether file uploading is disabled for a specific endpoint.', 'Setting this to `true` prevents any file uploads to the specified endpoint, overriding any other file-related settings.'],
  ]}
/>

**Default:** `false`

```yaml filename="fileConfig / endpoints / {endpoint_record} / disabled"
openAI:
  disabled: true
```

## fileLimit

**Key:**
<OptionTable
  options={[
    ['fileLimit', 'Integer', 'The maximum number of files allowed in a single upload request.', 'Helps control the volume of uploads and manage server load.'],
  ]}
/>

**Default:** Varies by endpoint

```yaml filename="fileConfig / endpoints / {endpoint_record} / fileLimit"
assistants:
  fileLimit: 5
```

## fileSizeLimit

**Key:**
<OptionTable
  options={[
    ['fileSizeLimit', 'Integer', 'The maximum size allowed for each individual file, specified in megabytes (MB).', 'This limit ensures that no single file exceeds the specified size, allowing for better resource allocation and management.'],
  ]}
/>

**Default:** Varies by endpoint

```yaml filename="fileConfig / endpoints / {endpoint_record} / fileSizeLimit"
YourCustomEndpointName:
  fileSizeLimit: 1000
```

## totalSizeLimit

**Key:**
<OptionTable
  options={[
    ['totalSizeLimit', 'Integer', 'The total maximum size allowed for all files in a single request, specified in megabytes (MB).', 'This setting is crucial for preventing excessive bandwidth and storage usage by any single upload request.'],
  ]}
/>

**Default:** Varies by endpoint

```yaml filename="fileConfig / endpoints / {endpoint_record} / totalSizeLimit"
assistants:
  totalSizeLimit: 50
```

## supportedMimeTypes

**Key:**
<OptionTable
  options={[
    ['supportedMimeTypes', 'Array of Strings', 'A list of regular expressions defining the MIME types permitted for upload.', 'This allows for precise control over the types of files that can be uploaded. Invalid regex is ignored.'],
  ]}
/>

**Default:** Varies by endpoint

```yaml filename="fileConfig / endpoints / {endpoint_record} / supportedMimeTypes"
assistants:
  supportedMimeTypes:
      - "image/.*"
      - "application/pdf"
```
