> For the complete documentation index, see [llms.txt](https://docs.appmixer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmixer.com/connector-configuration/utils/files/save-file.md).

# Save File

### Overview

The **File Storage Component** allows saving a file to the database with its metadata, including filename, MIME type, and encoding. This component enables efficient file storage and retrieval for various applications.

### Usage

This component is useful when files need to be uploaded and stored securely in a database for further processing or retrieval.

#### Properties

| Property          | Type               | Description                                                   |
| ----------------- | ------------------ | ------------------------------------------------------------- |
| `filename`        | `string`           | The name of the file to be stored.                            |
| `mimetype`        | `string`           | The MIME type of the file.                                    |
| `content`         | `array` / `string` | The content of the file to be saved.                          |
| `contentEncoding` | `string`           | The encoding format of the content (e.g., utf8, base64, hex). |

#### Input Ports

| Port | Description                           |
| ---- | ------------------------------------- |
| `in` | Accepts the file details for storage. |

#### Output Ports

| Port   | Description                                     |
| ------ | ----------------------------------------------- |
| `file` | Emits metadata of the successfully stored file. |

#### Processing Logic

1. **Receives Input Data**:
   * Accepts `filename`, `mimetype`, `content`, and `contentEncoding`.
2. **Saves the File**:
   * Stores the file in the database.
   * Uses the specified encoding format for content.
3. **Confirms Storage**:
   * Emits metadata of the stored file, including its unique `fileId`, `filename`, and `contentType`.
   * If an error occurs (e.g., invalid content), it is logged or raised appropriately.

#### Output Data Schema

| Property      | Type     | Description                        |
| ------------- | -------- | ---------------------------------- |
| `fileId`      | `string` | The identifier of the stored file. |
| `filename`    | `string` | The name of the stored file.       |
| `contentType` | `string` | The MIME type of the stored file.  |

### Notes

* **Supports Various Encoding Formats**: Content encoding options include `utf8`, `base64`, `hex`, and more.
* **Secure and Reliable Storage**: Ensures files are stored securely in the database.
* **Ideal for File Upload and Management Workflows**: Enables seamless file handling for applications requiring document storage and retrieval.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.appmixer.com/connector-configuration/utils/files/save-file.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
