stechstudio/laravel-upload-server

This package is abandoned and no longer maintained. No replacement package was suggested.

A robust Laravel backend for handling FilePond uploads with large file chunking support

1.0 2021-01-27 21:57 UTC

This package is auto-updated.

Last update: 2023-02-15 14:59:17 UTC


README

Latest Version on Packagist GitHub Workflow Status

A robust backend for handling file uploads, batteries included. Supports large chunked uploads. It is currently built for FilePond with planned support for Uppy.

Installation

You know the drill:

composer require stechstudio/laravel-upload-server

Quickstart

1. Add the route

In your routes file add:

UploadServer::route();

Note that this Route can be put inside a Route::group(), and you can also chain additional route details.

Route::prefix('app')->group(function () {
    UploadServer::route()->withoutMiddleware('csrf');
});

You will now have a route setup named upload-server using your default backend. Point your client-side upload integration to this endpoint.

Any file uploads sent to this endpoint will be handled for you and saved at the configured path.

2. Retrieve the saved files

Now when your form is submitted, take the UUIDs and retrieve the saved files:

public function handleFormSubmission(Request $request)
{
    // 'attachments' is the name of the client-side uploader
    $files = UploadServer::retrieve($request->input('attachments'));
}

You will receive back an array of File objects if there were multiple files submitted, otherwise you will have a single File instance.

3. Wrap up

You can now simply move the uploaded files to a permanent location, store details in a database, etc.

$files = UploadServer::retrieve($request->input('attachments'));

foreach($files AS $file) {
    $file->store('attachments', 's3');
}

That's it, seriously.

License

The MIT License (MIT). Please see License File for more information.