Multi-File Upload Handling with Binary Data and Sequential Processing - n8n Workflow

Learn how to build an efficient n8n workflow to handle bulk file uploads from a form, process binary data sequentially using an n8n loop, and save each file. Use this n8n template for advanced file management.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users needing complex file processing logic.

  • Developers mastering binary data handling in n8n.

  • Businesses requiring sequential batch processing of uploads.

  • Anyone looking for advanced n8n templates focusing on flow control and file operations.

Overview

This advanced n8n workflow addresses a common challenge in automation: efficiently handling multiple binary files submitted simultaneously via a single form event. When an n8n trigger receives multiple files, they are often grouped into a single array, which can complicate sequential operations.

This specific n8n template utilizes robust flow control techniques. It employs the Split Out Files n8n node to deconstruct the initial input item into individual items, followed by a custom loop (Loop Over Items). This n8n workflow demonstrates how to leverage the special {{$runIndex}} variable within the Read/Write File n8n node to correctly access dynamically named binary data fields (e.g., files0, files1), ensuring accurate saving and sequential processing for every uploaded file. This is a critical pattern for robust file management in n8n.

How it Works

The n8n workflow executes through a five-step process designed for robust file splitting and looping:


  1. Form Submission Trigger: The n8n workflow initiates when the Form - Load Multiple Files n8n trigger is submitted, capturing an array of files (configured here for JSON files).

  2. Splitting the Batch: The single incoming item containing the file array is immediately passed to the Split Out Files n8n node. This essential n8n node breaks the array into separate, individual items, ensuring that the required binary data is successfully carried forward for each file.

  3. Initiating the Loop: The individual items flow into the Loop Over Items n8n node (configured as a Split in Batches of size 1). This guarantees strict sequential processing for every file item.

  4. Saving Files Sequentially: Inside the loop, the Save Each File n8n node performs the write operation. A key configuration feature of this n8n node is the dynamic reference used for retrieving the binary data property: =files_{{$runIndex}}. The {{$runIndex}} variable provides the current loop count, enabling the n8n workflow to accurately retrieve and save the binary file associated with the specific item currently being processed.

  5. Finalizing the n8n Workflow: After all files are processed through the loop, the flow proceeds to the Continue Once n8n node (a No Operation node configured to run once). This step normalizes the output stream, ensuring only a single item continues downstream, regardless of the initial file count.

Installation Guide

To use this n8n template, follow these steps:


  1. Import: Download the provided JSON data and import it directly into your n8n instance.

  2. Activate Trigger: Locate the Form - Load Multiple Files n8n trigger node. Ensure the n8n workflow is active so the webhook URL is generated.

  3. Test Form: Access the generated form URL (available within the trigger settings) in your browser.

  4. Upload Files: Upload multiple JSON files (or change the file type settings in the n8n node if necessary) and submit the form.

  5. Review Credentials: The Save Each File n8n node uses the local filesystem. Ensure your n8n environment has the necessary permissions to write files to the desired location.

Node Details

Form - Load Multiple Files (n8n Trigger):
Function: Starts the n8n workflow upon submission of a web form.
Key Configuration: Configured to accept multiple file inputs (files) and restricts input types to .json.
Split Out Files (n8n Node):
Function: Transforms the single incoming item containing an array of files into multiple separate items, enabling item-by-item processing.
Key Configuration: Field To Split Out is set to files; Include Binary Data is checked, which is essential for preserving file content.
Loop Over Items (n8n Node - Split In Batches):
Function: Manages the sequential execution flow, processing each file item one at a time.
Key Configuration: Acts as a crucial flow control mechanism in this n8n workflow.
Save Each File (n8n Node - Read/Write File):
Function: Saves the binary content of the current file item to the local file system.
Key Configuration: The Data Property Name is dynamically set to =files{{$runIndex}} to accurately retrieve the binary data corresponding to the current item's position in the loop. The File Name is set to out{{ $json.files.filename }}.
Continue Once (n8n Node - NoOp):
Function: This utility n8n node ensures that only a single data item continues down the n8n workflow path after the loop concludes, streamlining subsequent operations.
Key Configuration: Set to Execute Once.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by

Featured*