File Upload

Handles file upload operations for processing documents and images in your workflow.

Quick Start

To get started:

  • Add the File Upload block to your flow
  • Configure upload settings
  • Files uploaded via the flow are processed and made available

Configuration

This block handles file upload operations within the workflow.

Common Input Format

msg.payload (object)

File information for upload.

Example:

{
  "file_path": "uploads/document.pdf",
  "file_name": "document.pdf"
}

Common Output Format

msg.payload (object)

Returns the uploaded file path and metadata.

Example:

{
  "uploaded_path": "storage/documents/document.pdf",
  "file_name": "document.pdf",
  "file_size": 102400
}

Example

Input (msg.payload)

{
  "file_path": "temp/invoice.pdf",
  "file_name": "invoice.pdf"
}

Output (msg.payload)

{
  "uploaded_path": "storage/invoices/invoice.pdf",
  "file_name": "invoice.pdf",
  "file_size": 51200,
  "content_type": "application/pdf"
}

Errors

When the block fails, it raises an error. Use a Catch block in your flow to handle failures and inspect the error payload.

Common mistakes

  • Invalid file path: Ensure the source file exists.
  • Unsupported file type: Check supported file formats.
  • Storage full: Verify storage capacity.

Best Practices

  • Validate file types before upload
  • Implement file size limits
  • Use unique file names to avoid conflicts
  • Clean up temporary files after processing