file-upload

workflowv1.0.0

File upload handling with multipart form-data support

Install

kdeps registry install file-upload

Then run locally:

kdeps exec file-upload

Configure LLM provider in ~/.kdeps/config.yaml (created automatically on first run).

README

File Upload Example

This example demonstrates file upload handling in KDeps v2 with multipart form-data support.

Features

  • ✅ Single file uploads
  • ✅ Multiple file uploads
  • ✅ File metadata access (count, names, types)
  • ✅ File content, path, and MIME type access via get()
  • ✅ File info via info() functions

Run Locally

# From examples/file-upload directory
kdeps run workflow.yaml --dev

# Or from root
kdeps run examples/file-upload/workflow.yaml --dev

Test

Single File Upload

curl -X POST http://localhost:16395/api/v1/upload \
  -F "file=@example.txt"

Multiple File Upload

curl -X POST http://localhost:16395/api/v1/upload \
  -F "file[]=@file1.txt" \
  -F "file[]=@file2.pdf" \
  -F "file[]=@file3.jpg"

Response

{
  "success": true,
  "data": {
    "message": "File processed successfully",
    "file_count": "2",
    "files": ["file1.txt", "file2.pdf"],
    "file_types": ["text/plain", "application/pdf"],
    "file_info": [
      {
        "filename": "...",
        "path": "/tmp/kdeps-uploads/...",
        "type": "text/plain"
      }
    ]
  }
}

Structure

file-upload/
├── workflow.yaml              # Main workflow configuration
└── resources/
    └── file-processor.yaml   # File processing resource

Key Concepts

File Access Functions

info() for metadata:

  • info('filecount') - Number of uploaded files
  • info('files') - Array of file paths
  • info('filetypes') - Array of MIME types

get() for file data:

  • get('filename', 'file') - File content
  • get('filename', 'filepath') - File path
  • get('filename', 'filetype') - MIME type

Auto-Detection

Files uploaded with field name file or file[] are automatically available via get('file').

File Field Names

  • file - Single file
  • file[] - Multiple files
  • files - Alternative name for multiple files
  • Any field name - Automatically detected

Versions

VersionPublishedStatus
1.0.04/11/2026active

Details

Author
kdeps
License
Apache-2.0
Latest Version
1.0.0
Published
4/11/2026

Tags

fileuploadhttp