MultipartConfig class

Configuration for handling multipart file uploads.

This class controls limits and behavior for file uploads through multipart form data. It helps protect against denial-of-service attacks and ensures uploaded files meet security requirements.

Example:

final config = MultipartConfig(
  maxMemory: 64 * 1024 * 1024,
  maxFileSize: 20 * 1024 * 1024,
  allowedExtensions: {'jpg', 'png', 'pdf', 'docx'},
  uploadDirectory: 'storage/uploads',
);
Implemented types

Constructors

MultipartConfig({int maxMemory = 32 * 1024 * 1024, int maxFileSize = 10 * 1024 * 1024, int? maxDiskUsage, Set<String>? allowedExtensions, String uploadDirectory = 'uploads', int filePermissions = 0x1e8})
Creates a multipart configuration with the given settings.

Properties

allowedExtensions Set<String>
Set of allowed file extensions for uploads.
final
filePermissions int
File permissions for uploaded files in octal notation.
final
hashCode int
The hash code for this object.
no setterinherited
maxDiskUsage int
Maximum total disk usage per request in bytes.
final
maxFileSize int
Maximum file size allowed for individual uploads in bytes.
final
maxMemory int
Maximum memory size allowed for file uploads in bytes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uploadDirectory String
Directory where uploaded files will be stored.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
validate(ConfigValidationContext context) → void
Creates a ValidatableConfiguration.
override

Operators

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