- How do I install and configure pion/laravel-chunk-upload in a Laravel app?
- Install it with composer require pion/laravel-chunk-upload; Laravel's package auto-discovery registers the service provider for you. Publish the config file with php artisan vendor:publish and set the chunk storage disk and temp path it should use. Then define an upload route and a controller that builds a FileReceiver with the handler matching your frontend. Before installing, verify the illuminate/support constraint against your current Laravel release.
- Which JavaScript upload libraries does laravel-chunk-upload support (Dropzone, jQuery File Upload, FilePond)?
- It ships handlers for jQuery File Upload, Dropzone, PUPLoad and resumable.js, plus a generic chunked handler for anything that follows the same chunk metadata conventions. FilePond support is also noted in the package description. The backend handler must match the JavaScript provider you standardize on, so choose the frontend first. Switching widgets later is a backend change, not just a frontend one, so plan for that in your integration.
- What Laravel and PHP versions does pion/laravel-chunk-upload support?
- There is no universal answer; check the illuminate/support constraint in composer.json on Packagist against the Laravel version you actually run. Laravel version compatibility, rather than feature set, is the usual blocker when evaluating this package. Also confirm the PHP version constraint matches your runtime before you add it to the upload critical path.
- How do I create a controller and route to handle chunked uploads in Laravel?
- Register a POST route, then in the controller construct a FileReceiver with your chosen provider handler and call receive() on the incoming request. Branch on isComplete() and, when true, delegate to the handler so the stored chunks are assembled into the final file on your configured disk. Otherwise return the status or chunk index the frontend expects. Finally point your JavaScript upload widget at that route.
- How does laravel-chunk-upload know when an upload is complete and how are chunks assembled?
- The frontend sends chunk metadata such as file identifier, chunk index and total chunks, and the package writes each chunk to the configured disk. When the final chunk arrives, receive() reports isComplete() as true and the handler merges the stored chunks into one file. That assembly runs on the request thread, so large files are bounded by PHP-FPM memory limits and max_execution_time rather than by the package itself. Tune chunk size and file size limits so the merge stays inside those budgets.
- Is pion/laravel-chunk-upload compatible with S3 or other Laravel filesystem disks?
- It reads and writes through Laravel's Storage facade, so S3 and any other configured disk work. The caveat is the temp-then-assemble model: chunks are written to storage and then merged into a final object, which adds double-write cost on object storage. For very large files or high volume, compare that cost against a browser-to-S3 multipart upload that bypasses PHP entirely.
- How do I validate file types, authorize users and scan uploads with laravel-chunk-upload?
- The package deliberately leaves these concerns to your application; authorization, quota enforcement, MIME and magic-byte validation, filename sanitization and malware scanning are not built in. Validate and authorize in a FormRequest or policy before accepting chunks, and scan the assembled file before it is served or moved to permanent storage. Treat every chunk request as untrusted input. Also enforce a maximum size and chunk count so clients cannot fill the temp disk.
- How do I clean up abandoned or orphaned chunk files?
- Partial uploads never trigger assembly, so their chunks sit on the temp disk until something removes them. Add a scheduled artisan command or job that deletes chunk directories older than a sensible threshold, register it with Laravel's scheduler, and monitor temp disk usage. The package does not ship a cleanup job for you, so this is your responsibility. Alerting on disk growth is a cheap early warning that clients are abandoning uploads.
- Does chunked upload work with multiple app servers behind a load balancer?
- Chunk state lives on the filesystem disk rather than in the session, so multiple nodes work as long as all of them see the same storage. Point the chunk temp disk at shared storage such as S3, or configure sticky sessions if you rely on local disk. With local disk spread across several nodes you will get interleaved missing chunks and failed assembly. Verify this before scaling the app horizontally.
- Is pion/laravel-chunk-upload actively maintained, and what are the alternatives for large uploads in Laravel?
- It is a narrow-scope, MIT-licensed package with a single maintainer, so check the changelog, commit cadence and issue responsiveness before putting it on the upload critical path. Star counts are a weak signal, and the Packagist dependent count is a counting artifact rather than an adoption measure. If the maintenance posture does not fit, alternatives include the tus resumable upload protocol, presigned S3 multipart uploads from the browser, or a managed upload service. Migration is additive, so piloting on one client surface stays cheap to roll back.