UploadedFile class

Represents a file uploaded via a multipart/form-data request.

In Kronix, uploaded files are streamed to disk by default to prevent memory exhaustion on large uploads.

Security Note: The filename property is the raw, untrusted value from the client. Always use safeFilename when constructing file paths to prevent path traversal attacks.

Constructors

UploadedFile({required String filename, required String contentType, required String tempPath, required int size, String? tempDir})
Creates a new UploadedFile instance.

Properties

contentType String
The MIME type of the file.
final
filename String
The original filename as provided by the client.
final
hashCode int
The hash code for this object.
no setterinherited
isDeleted bool
Returns true if the temporary file has already been deleted or moved.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
safeFilename String
Returns a sanitized version of filename safe for use in file paths.
no setter
size int
The size of the file in bytes.
final
tempDir String?
The internal path to the temporary directory.
final
tempPath String
The internal path to the temporary file on disk.
final

Methods

delete() Future<void>
Deletes the temporary file and directory.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openRead() Stream<List<int>>
Opens a stream to read the file content.
readAsBytes({int? maxSize}) Future<List<int>>
Reads the entire file content as bytes.
saveAs(String path) Future<File>
Saves the file to the specified path and deletes the temporary file.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited