Store Files icon

Store Files

Store uploaded files on the disk

Overview

This node stores uploaded files from incoming binary data onto the local disk at a specified directory path. It is useful in workflows where you need to persist files received or generated during automation, such as saving attachments from emails, images from APIs, or any binary content for later use or processing.

Common scenarios include:

  • Archiving files processed in a workflow.
  • Saving user-uploaded files to a server directory.
  • Caching files locally before uploading them to cloud storage or other services.

The node can optionally hash filenames to avoid collisions and ensure unique file names.

Properties

Name Meaning
Destination Path The directory path where the files will be stored. If the folder does not exist, it will be created automatically. Default is /usr/src/app/n8n_storage/uploaded_files. Warning: Files without hashed names may be overwritten if names clash. Also, the app must have write permission to this directory.
Hash Filenames Boolean option to determine if filenames should be hashed. If true, filenames are hashed with an MD5 hash combined with a timestamp to create unique names, preventing overwriting. If false, original filenames are used.

Output

The node outputs the original input JSON data augmented with a new field stored_files inside each item's JSON. This field is an array of objects, each representing a stored file with the following structure:

[
  {
    "fileName": "the actual stored filename (hashed or original)",
    "fileOriginName": "the original filename from the input",
    "filePath": "the full absolute path on disk where the file was saved"
  }
]

If multiple binary properties exist in an item, all stored files are listed in this array.

The node writes the binary data to disk as base64-decoded buffers.

Dependencies

  • Requires Node.js built-in modules: fs (filesystem), path, and crypto.
  • No external API or service dependencies.
  • The node requires appropriate filesystem permissions to create directories and write files at the specified destination path.

Troubleshooting

  • Permission errors: If the node fails to write files, check that the n8n process has write access to the destination directory.
  • File overwriting: When Hash Filenames is false, files with the same name will overwrite existing files. Enable hashing to avoid this.
  • Invalid paths: Ensure the destination path is valid and accessible. Relative paths are resolved based on the environment running n8n.
  • Empty or missing binary data: If no binary data is present in the input items, no files will be written, and the output stored_files array will be empty.

Links and References

Discussion