Secure Uploads
File upload security for Laravel: content-type validation with magic-byte sniffing, filename sanitization, pluggable malware scanning, secure signed-URL storage, upload rate limiting and quarantine workflows.
v1.0.1
MIT License
★ 0
composer require artisanpack-ui/secure-uploads
$ composer require artisanpack-ui/secure-uploads
✓ Installed
$ php artisan migrate
✓ Migrated secure files & quarantine tables
$post->attachSecureFile($request->file('attachment'));
What it does
Uploads you can actually trust
A full validation pipeline, pluggable malware scanning, signed-URL storage and quarantine \u2014 so a bad file never reaches your public root.
Validation pipeline
MIME sniffing, magic-byte checks, allowlists, size limits and double-extension detection.
Validation rules
SafeFilename and SecureFile rule classes drop straight into Form Requests.
Malware scanning
Pluggable ClamAV and VirusTotal scanners, with a null driver for dev and CI.
Secure storage
Files stored outside the public root, served only through signed URLs.
Quarantine workflow
Files flagged by async scanning wait in quarantine until cleared by a command.
Rate limiting & events
Upload rate limiting plus FileUploaded, FileServed and MalwareDetected events.
Get started
Install and migrate
Add the HasSecureFiles concern to any model, then attachSecureFile() validates, scans, sanitizes and stores behind a signed URL.
1 · Install
composer require artisanpack-ui/secure-uploads
2 · Run migrations
php artisan migrate
3 · Publish config (optional)
php artisan vendor:publish --tag=secure-uploads-config
Requirements
What you need
| Requirement | Detail |
|---|---|
| PHP | 8.2+ with ext-fileinfo |
| Laravel | 10, 11 or 12 |
| Scanning | ClamAV daemon/binary or VirusTotal API (optional) |
| Part of the ArtisanPack UI Security 2.0 restructure — the upload features formerly bundled in artisanpack-ui/security 1.x live here. | |
Lock down uploads with Secure Uploads
Validation, malware scanning, signed-URL storage and quarantine in one command. Free and open source under the MIT license.
