---
title: File Document Loader
description: Load a file (PDF, HTML, text) as text to feed into the Indexer
---

Turn a PDF, HTML or text file into plain text, ready to index into a knowledge base.

## What it does

File Document Loader takes a file carried by the incoming item and puts its text in one output field, named by **Output field name** (`text` by default). It works out the file type from its MIME type, or else from the file name's extension:

* **PDF**: the text of all pages, joined into one string. Uses the same extraction as [PDF Parser](/nodes/builtin/datatransformation/pdfparser/).
* **HTML**: converted to clean plain text.
* **Text formats**: CSV, JSON, XML, Markdown and TXT (and any `text/` type) are read as they are.

It first looks for a file attachment under **Binary key / field**. If there is none, it reads a field of that name holding a base64 string or a data URL (`data:application/pdf;base64,...`).

## When to use it

* Index a PDF report, a Markdown doc or an exported CSV into a knowledge base.
* Handle a mix of PDF, HTML and text files with one node.
* When you only need the text of a PDF and won't index it, [PDF Parser](/nodes/builtin/datatransformation/pdfparser/) gives more control.

## Inputs and settings

* **Binary key / field** is the name only, not an expression: for example `content`, not `{{ $input.content }}`.
* A data URL already says its type. For a plain base64 string, set **MIME type** (for example `application/pdf`) or a **File name** such as `report.pdf`.

## Outputs

Each item has the file's text in the field you named (default `text`). With **Include input fields** on, the incoming fields are kept next to it, which is handy to reuse the file name as **Source name** on the Indexer.

## Dependencies and credentials

None. This node needs no connection and has no slots for other nodes.

## Example workflow

1. [Local File Read](/nodes/builtin/datatransformation/localfileread/) with **Read as** `Data URL` and **Accepted file types** `.pdf, .md` lets you pick a file. Its content arrives in `content` and its name in `name`.
2. File Document Loader with **Binary key / field** `content`, **Output field name** `text` and **Include input fields** on.
3. [Indexer](/nodes/builtin/ai/aiagents/indexernode/) with **Input** `{{ $input.text }}` and **Source name** `{{ $input.name }}`. Connect [Local Knowledge](/nodes/builtin/ai/aidependencies/vectorstore/localknowledge/) to **Knowledge** and [Recursive Character Text Splitter](/nodes/builtin/ai/aidependencies/textsplitter/recursivecharactertextsplitter/) to **Text Splitter**.

## Common issues

* **"No source node is connected to this node."** The loader needs an incoming item that carries the file. Connect the node that provides it.
* **"No binary attachment or field "…" found on the input item…".** Nothing is stored under **Binary key / field**. Check the field name in the previous node's output and type it exactly.
* **"Unsupported document type (mimeType: unknown, fileName: unknown)…".** The loader can't tell the file type. Set **MIME type** or **File name**, or convert the file to PDF, HTML or text first. Word and image files are not supported.
* **The text is empty for a PDF.** The PDF is a scanned image with no text layer. Run it through text recognition first.

## Related nodes

* [Indexer](/nodes/builtin/ai/aiagents/indexernode/): save the text into a knowledge base.
* [PDF Parser](/nodes/builtin/datatransformation/pdfparser/): PDF text with per-page options.
* [Local File Read](/nodes/builtin/datatransformation/localfileread/): pick a file from your computer.
* [URL Document Loader](/nodes/builtin/ai/loaders/urldocumentloader/): load a web page instead.