Upload documents with validation, deduplication and Postgres storage
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 Postgres. It ensures clean, consistent, and duplicate-free document intake.
How It Works
Document Upload Users upload files through a form or webhook endpoint.
Configuration
Defines:
Maximum file size
Allowed file types
Storage settings
File Validation
The workflow checks:
File size against limits
MIME type against allowed formats
Invalid files are rejected with a clear error response.
Metadata Generation
Generates:
Unique document ID (UUID)
File hash (SHA-256)
File name, size, and type
Upload timestamp and source
Duplicate Detection Uses the file hash to check if the document already exists in the database.
Conditional Processing
Duplicate found → returns existing document reference
New document → proceeds to storage
Database Storage Stores document metadata in Postgres with a received status.
Response Handling
Success → returns document ID
Duplicate → returns existing document ID
Error → returns validation details
Setup Instructions
Configure form trigger or webhook endpoint
Set max file size and allowed MIME types in config node
Connect Postgres credentials
Create a documents table with required fields
Update configuration values as needed
Test with sample document uploads
Activate the workflow
Use Cases
Secure document upload systems
Preventing duplicate file storage
Building document intake APIs
Managing tax or financial documents
Creating audit-ready upload pipelines
Requirements
n8n instance with form/webhook support
Postgres database
File upload handling enabled
Notes
SHA-256 hashing ensures accurate duplicate detection. You can extend storage to cloud services like S3 or Google Cloud Storage. Add authentication to webhook endpoints for production use. Customize validation rules based on your business requirements.
Related Templates
Extract Title tag and Meta description from url for SEO analysis with Airtable
Extract Title tag and meta description from url for SEO analysis. How it works The workflows takes records from Airtabl...
Restore your workflows from GitHub
This workflow restores all n8n instance workflows from GitHub backups using the n8n API node. It complements the Backup ...
Extract Named Entities from Web Pages with Google Natural Language API
Who is this for? Content strategists analyzing web page semantic content SEO professionals conducting entity-based anal...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments