Upload documents with validation, deduplication and Postgres storage
Ready for 3.0What this workflow does
This workflow has 12 nodes and runs when someone submits an n8n form (“Tax Document Upload”) (plus 1 other trigger). Along the way it connects Postgres.
How it runs
Trigger: When someone submits an n8n form (“Tax Document Upload”) (plus 1 other trigger).
- Workflow Configuration (Edit Fields (Set)): sets 3 fields: maxFileSizeMB, allowedMimeTypes, storageBasePath
- Check File Size (If): checks a condition and branches into true / false
- Check MIME Type (If): checks a condition and branches into true / false
- Return Validation Error (Edit Fields (Set)): sets 4 fields: status, message, allowed_types…
- Generate Document Metadata (Code): runs custom JavaScript code
- Check for Duplicate (Postgres): run a query
- Is Duplicate? (If): checks a condition and branches into true / false
- Return Duplicate Response (Edit Fields (Set)): sets 3 fields: status, message, existing_document_id
- Insert Document Record (Postgres): run a query
- Return Success Response (Edit Fields (Set)): sets 3 fields: status, message, document_id
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (6)
- n8n Form Trigger
n8n-nodes-base.formTrigger - Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Code
n8n-nodes-base.code - Postgres
n8n-nodes-base.postgres
From the author
Overview This workflow provides a reliable and secure system for uploading and managing documents. It accepts files via form or webhook, validates file size and type, generates unique metadata, detects duplicates using file hashing, and stores records in…