ashiful / upload
Laravel Secure File Upload & Media Guard
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/ashiful/upload
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2026-01-01 16:49:19 UTC
README
A robust, secure, and modern Laravel package for handling file uploads with virus scanning, MIME validation, and frontend integration.
Features
- 🔒 Secure Uploads: MIME validation, extension checks.
- 🦠 Virus Scanning: Hookable interface (ClamAV ready).
- ⏱️ Temporary Access: Signed URLs for temporary file access.
- 🧹 Orphan Cleanup: Auto-delete temporary files via Artisan command.
- 🖼️ Frontend Ready: Drag & Drop components for Blade, React, and Vue.
- 🧩 SOLID Architecture: Swappable drivers.
Installation
Add the package to your composer.json (if local) or install via composer.
composer require ashiful/upload
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=upload-config
Customization
You can publish the views and assets to modify them:
# Publish views to resources/views/vendor/upload php artisan vendor:publish --tag=upload-views # Publish JS/Vue/React components to resources/js/vendor/ashiful/upload php artisan vendor:publish --tag=upload-assets
Usage
Backend Service
use Ashiful\Upload\Facades\SecureUpload; // Basic Upload $path = SecureUpload::upload($request->file('file'), 'uploads'); // Get Signed URL $url = SecureUpload::getSignedUrl($path, 60); // 60 minutes
Cleanup Command
Add to your App\Console\Kernel.php schedule or run manually:
php artisan upload:cleanup --hours=24
Frontend Components
Blade
Include the Blade component in your view:
@include('upload::dropzone')
React
Import the component:
import ReactUpload from '../../packages/ashiful/upload/resources/js/components/ReactUpload'; <ReactUpload uploadUrl="/upload/media" csrfToken={token} />
Vue
Import the component:
import VueUpload from '../../packages/ashiful/upload/resources/js/components/VueUpload.vue'; <VueUpload upload-url="/upload/media" :csrf-token="token" />
Testing
To run the package tests specifically:
php artisan test packages/ashiful/upload