NAME

PAGI::Request::MultiPartHandler - Async multipart/form-data parser

SYNOPSIS

my $handler = PAGI::Request::MultiPartHandler->new(
    boundary        => $boundary,
    receive         => $receive,
    max_field_size  => 1 * 1024 * 1024,   # 1MB for form fields
    max_file_size   => 10 * 1024 * 1024,  # 10MB for file uploads
);

my ($form, $uploads) = await $handler->parse;

DESCRIPTION

Parses multipart/form-data requests asynchronously. Applies separate size limits to form fields (max_field_size) and file uploads (max_file_size).

OPTIONS

max_field_size => $bytes

Maximum size for non-file form fields. Default: 1MB.

Protects against oversized text field submissions.

max_file_size => $bytes

Maximum size for file uploads. Default: 10MB.

Applies to parts with a filename in the Content-Disposition header.

max_files => $count

Maximum number of file uploads allowed. Default: 20.

max_fields => $count

Maximum number of form fields allowed. Default: 1000.

spool_threshold => $bytes

Size at which parts are spooled to temporary files instead of memory. Default: 64KB.

temp_dir => $path

Directory for temporary files. Default: $ENV{TMPDIR} or /tmp.