filament-dedupler-uploader is plugin for Filament that prevents duplicate file storage by detecting files with identical content before saving them to storage.
Instead of storing multiple copies of the same file, it uses content-based hashing (SHA1) to ensure each unique file is stored only once - regardless of how many times or by whom it is uploaded.
This is especially useful for applications where users frequently upload the same documents, images, or other files, helping to:
- Save disk space by eliminating redundant copies
- Maintain data integrity through content-based identification
- Reduce storage costs especially for SSD storage in 2026 ;)
- 🔍 Automatic deduplication - Files are compared by SHA1 hash before storage
- 📦 Seamless integration - Based on Filament's
FileUploadcomponent - 🔗 Smart relationships - Attaches
uniqueFilesrecords to Eloquent models via theDeduplabletrait - 📋 Infolist components - Display uploaded files with metadata (original name, size, SHA1 hash, download)
- 🗂️ Multiple file support - Handles single and multiple file uploads
- PHP 8.1+
- Laravel 12+
- Filament 5.x
composer require maxkhim/filament-dedupler-uploader
php artisan dedupler:install
php artisan dedupler:checkuse Maxkhim\FilamentDeduplerUploader\FilamentDeduplerUploaderPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
FilamentDeduplerUploaderPlugin::make()
]);
}Your Eloquent model can use the Deduplable trait from laravel-storage-dedupler for simplicity linking files:
use Illuminate\Database\Eloquent\Model;
use Maxkhim\Dedupler\Traits\Deduplable;
class Document extends Model
{
use Deduplable;
// The trait provides the relationship and attachUniqueFile() method
}Based on Filament's FileUpload component
use Maxkhim\FilamentDeduplerUploader\Forms\Components\DeduplerFileUploader;
DeduplerFileUploader::make('attachment')
->multiple()Displays files in a table with original name, size, download button, and SHA1 hash, using standard Filament components under hood:
use Maxkhim\FilamentDeduplerUploader\Infolists\DeduplerFilesRepeatableEntry;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
public function infolist(Infolist $infolist): Infolist
{
return $infolist->schema([
Section::make('Uploaded Files')
->schema([
DeduplerFilesRepeatableEntry::make()
->label('Documents'),
]),
]);
}- User uploads a file in the Filament form and saves record
- SHA1 hash is computed from the file content
- Deduplication check - If a file with the same hash already exists in storage, it is reused instead of being saved again
- Relationship attachment - The polymorphic
uniqueFilesrecord attribute is attached to the model via theDeduplabletrait - Form submission - The file path and SHA1 hash is stored in the database
Physical file deletion is managed by the laravel-storage-dedupler package. When a file is removed from a model, the relationship is detached.
The MIT License (MIT). Please see License File for more information.
This package is built on top of maxkhim/laravel-storage-dedupler.
