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
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
USDT And TRC20 Wallet Tracker API Workflow for n8n
Overview This n8n workflow is specifically designed to monitor USDT TRC20 transactions within a specified wallet. It u...
Add product ideas to Google Sheets via a Slack
Use Case This workflow is a slight variation of a workflow we're using at n8n. In most companies, employees have a lot o...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments