n8n node for uploading multiple binary files dynamically with pattern filtering
npm install n8n-nodes-multiple-upload-request*, ?) để chọn lọc file cần upload
bash
npm install n8n-nodes-multiple-upload-request
`
Cách sử dụng
$3
Tìm kiếm "Multiple Upload Request" trong danh sách nodes của n8n.
$3
Authentication: Chọn phương thức xác thực
- None: Không cần xác thực
- Bearer Token: Sử dụng Bearer token (cần credential)
- Custom Header: Sử dụng custom header authentication (cần credential)
Request Method: Chọn HTTP method (POST/PUT/PATCH)
URL: URL endpoint để upload file
File Pattern: Pattern để lọc file (mặc định: * - tất cả file)
- * - Upload tất cả file
- *.jpg - Chỉ upload file .jpg
- image_* - Upload file bắt đầu bằng "image_"
- file_?.pdf - Upload file như file_1.pdf, file_a.pdf
Binary Property Name: Tên property chứa binary data (mặc định: data)
- Có thể nhập nhiều property, phân cách bằng dấu phẩy: data, file, attachment
$3
#### Additional Form Fields
Thêm các field text vào form data cùng với file upload.
#### Query Parameters
Thêm query parameters vào URL request.
#### Additional Headers
Thêm custom headers vào request (ví dụ: Content-Type, X-Custom-Header).
#### Timeout
Cấu hình thời gian timeout cho request (mặc định: 10000ms).
#### Ignore SSL Issues
Bỏ qua lỗi SSL certificate validation (hữu ích cho môi trường development).
Ví dụ sử dụng
$3
`
File Pattern: *.jpg
Binary Property Name: data
`
$3
`
File Pattern: *
Binary Property Name: image, document, attachment
`
$3
`
Authentication: Bearer Token
Request Method: POST
URL: https://api.example.com/upload
File Pattern: *
`
$3
`
Additional Form Fields:
- userId: 12345
- category: documents
- tags: important,urgent
`
Pattern Matching
Node hỗ trợ wildcard patterns để lọc file:
- * - Khớp với bất kỳ ký tự nào (0 hoặc nhiều)
- ? - Khớp với đúng 1 ký tự
- Pattern không phân biệt hoa thường
Ví dụ patterns:
- *.pdf → Tất cả file PDF
- report_*.xlsx → Các file Excel bắt đầu bằng "report_"
- image_?.png → image_1.png, image_a.png, image_x.png
- 2024-??-*.jpg → 2024-01-photo.jpg, 2024-12-image.jpg
Credentials
$3
Để sử dụng Bearer Token authentication:
1. Tạo credential mới loại Bearer Token Auth
2. Nhập Bearer token của bạn
3. Chọn credential này trong node
$3
Để sử dụng Custom Header authentication:
1. Tạo credential mới loại Custom Header Auth
2. Nhập Header Name (ví dụ: X-API-Key, Authorization)
3. Nhập Header Value (giá trị của header)
4. Chọn credential này trong node
API Response
Node trả về response JSON từ server:
`json
{
"success": true,
"message": "Files uploaded successfully",
"files": [
{
"filename": "image1.jpg",
"size": 102400,
"url": "https://example.com/uploads/image1.jpg"
}
]
}
`
Xử lý lỗi
Node hỗ trợ Continue on Fail mode:
- Khi bật: Lỗi sẽ được trả về dưới dạng JSON và workflow tiếp tục
- Khi tắt: Lỗi sẽ dừng workflow
Development
$3
- Node.js (v22 trở lên) và npm
- git
$3
`bash
git clone https://github.com/OrgGem/n8n-nodes-multiple-upload-request.git
cd n8n-nodes-multiple-upload-request
npm install
`
$3
Chạy n8n với node được load và hot reload enabled:
`bash
npm run dev
`
$3
Build node cho production:
`bash
npm run build
`
$3
`bash
npm run lint
npm run lint:fix
`
Testing
Xem TESTING_GUIDE.md để biết chi tiết về các test scenarios và cách validate node.
Use Cases
$3
Workflow nhận nhiều ảnh từ webhook form submission và upload lên cloud storage.
$3
Upload hàng loạt documents từ một folder vào document management system.
$3
Định kỳ backup các file quan trọng lên remote storage với authentication.
$3
Upload ảnh đã xử lý (resize, watermark) lên CDN.
$3
Upload file của nhiều users khác nhau với dynamic authentication headers.
Công nghệ sử dụng
- TypeScript - Type-safe development
- n8n-workflow - n8n SDK và types
- Node.js - Runtime environment
- Multipart form-data - File upload handling
Cấu trúc thư mục
`
nodes/MultipleUploadRequest/
├── MultipleUploadRequest.node.ts # Main node implementation
├── MultipleUploadRequest.node.json # Node metadata
├── description.ts # UI property definitions
├── utils.ts # Wildcard pattern matching
├── upload.svg # Light mode icon
└── upload.dark.svg # Dark mode icon
credentials/
├── BearerTokenAuthApi.credentials.ts # Bearer token auth
└── CustomHeaderAuthApi.credentials.ts # Custom header auth
`
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (git checkout -b feature/AmazingFeature)
3. Commit your changes (git commit -m 'Add some AmazingFeature')
4. Push to the branch (git push origin feature/AmazingFeature`)