Import
What it does
FileUploadHelper exposes a set of static methods that cover the most common file-upload workflows: single and multi-file uploads, chunked uploads for large files, client-side validation, and FormData construction. Every upload method returns a typed UploadResult and supports progress callbacks.
Methods
Wraps one or more File objects into a FormData instance.
uploadFile(url, file, options?)
Uploads a single file and returns an UploadResult.
uploadFiles(url, files, options?)
Uploads multiple files in parallel. Returns UploadResult[].
createChunks(file, chunkSize?)
Splits a File into Blob[] chunks.
uploadChunked(url, file, options?)
Uploads a file in chunks with automatic retry per chunk.
validateFile(file, constraints)
Validates a file against size, MIME type, and extension constraints. Returns a ValidationResult.
getFileInfo(file)
Returns metadata about a File object.
Types
FileUploadOptions
UploadResult
ValidationResult
FileInfo
Constraints
Examples
Validate before upload
Chunked upload with retry
Resumable upload
Use uploadedChunks from a failed result as resumeFrom on the next call.
The server must store chunks by X-Upload-ID so they can be reassembled.
Concurrent chunks with live progress
Speed up large uploads on fast connections by sending multiple chunks in parallel.
Always call validateFile before uploading to give users instant feedback without waiting for a server round-trip.
createChunks returns in-memory Blob slices. For very large files, upload chunks as they are created instead of buffering the entire array.