Uniform::Upload

CPAN version License: MIT

Framework-agnostic upload manager and base driver engine for Perl.

Uniform::Upload provides a unified interface for inspecting, validating, and managing file upload payloads across web applications. It serves as both a standalone file upload factory and an abstract base engine for framework-specific drivers.

Installation

Install using cpanm or your preferred CPAN client:

cpanm Uniform::Upload

Synopsis

use Uniform::Upload;

# Initialize standalone manager
my $upload = Uniform::Upload->new(
    max_size      => '5MB',
    allowed_types => [qw( image/png image/jpeg application/pdf )],
);

# Wrap raw upload payload hashes into validated objects
my $file = $upload->wrap(
    name     => 'avatar',
    filename => 'user_photo.png',
    tmp_path => '/tmp/cpan_upload_12345',
    size     => 2048576,
    type     => 'image/png',
);

if ($file->is_valid) {
    $file->copy_to('/var/uploads/' . $file->sanitized_filename);
} else {
    die "Upload failed validation: " . $file->error;
}

Key Features

Local Development & Testing

Run the test suite using prove:

prove -Ilib t/

This software is Copyright (c) 2026 by Joshua S. Day <HAX@cpan.org>[cite: 9, 10].

This is free software, licensed under:

The MIT (X11) License