Skip to main content

File Uploads

PrismUploadProcessor handles the heavy lifting of file uploads: it parses multipart requests, validates size and type constraints, saves files to a temporary directory, and gives you a clean result object to work with.

Quick Start

Basic File Upload

Upload Configuration

Control what gets accepted before it hits your handler:
Configured Upload

Working with Uploaded Files

PrismUploadedFile provides everything you need:
File Operations

Multiple Files with Form Fields

The upload result separates files from regular form fields:
Product Listing with Images

Error Handling

Upload errors are typed and specific:
Handling Upload Errors
Always call result.cleanup() or file.cleanup() after processing to remove temporary files. Use defer to ensure cleanup happens even if your handler throws.
Use result.file (singular) as a shortcut when you expect exactly one file upload — it returns the first uploaded file or nil.