Create a file upload handler
Accept multipart uploads, validate type and size, store to S3 or disk with a unique filename, and return the public URL. Handles all common upload failure modes.
Preview
Copy prompt
Write a file upload handler in [Language/Framework] that accepts multipart form data containing a file. Validate the uploaded file's MIME type and size on the server side before accepting it. Store the file to [S3 / local disk / GCS] with a securely generated unique filename, then return the public URL of the stored file. Add explicit error handling for oversized uploads, disallowed file types, and storage backend failures.
More
Code Generation
Prompts
