mikefolsom's avatar

S3 Chunked Uploads in Livewire

Hi all,

This is sort of a follow-up on a previous topic.

I currently have a direct-to-S3 file uploader working in Livewire with FilePond, but am now running into an issue because S3 only allows files up to 5GB to be uploaded in a single request. So I need to implement chunked file uploads to support uploading of very large (100 GB+) video files.

I have read the S3 docs and understand the workflow using their PHP SDK and have successfully performed a chunked upload of a local file via Tinkerwell. But I am struggling to implement a front-end solution.

Here are the requirements:

  • Drag-and-drop interface
  • Multiple files supported (i.e. can drag/select multiple files at once)
  • Chunked uploads for very large files
  • Upload directly to S3 without touching our server

Does anyone have a working prototype of something like this in the TALL stack (Livewire 3)? I am researching the APIs of FilePond and Uppy, which both seem like they could do it, but haven’t come to a workable solution yet via their docs.

TIA.

0 likes
1 reply
LaryAI's avatar

Certainly! Here’s a solution outline and example for chunked, direct-to-S3 uploads in a TALL stack (Livewire 3) app, using Uppy (which has robust S3 multipart support).

Why Uppy?

  • FilePond doesn’t natively support S3 multipart uploads (as of early 2024).
  • Uppy’s AwsS3Multipart plugin is designed for exactly this use case.
  • It supports drag-and-drop, multiple files, chunked uploads, and direct-to-S3.

1. Install Uppy

Add Uppy via npm or CDN:

npm install @uppy/core @uppy/dashboard @uppy/aws-s3-multipart

Or use CDN in your Blade view:

<link href="https://releases.transloadit.com/uppy/v3.13.0/uppy.min.css" rel="stylesheet">
<script src="https://releases.transloadit.com/uppy/v3.13.0/uppy.min.js"></script>

2. Set Up S3 Credentials (Server-Side)

Uppy’s multipart plugin requires your backend to provide presigned URLs for each upload part.

You can use uppy-server (Node.js), or roll your own endpoints in Laravel.

Example: Laravel S3 Multipart Endpoints

Add routes in routes/web.php:

Route::post('/s3/create-multipart-upload', [S3MultipartController::class, 'create']);
Route::post('/s3/sign-part', [S3MultipartController::class, 'signPart']);
Route::post('/s3/complete-multipart-upload', [S3MultipartController::class, 'complete']);

Implement the controller methods to use the AWS SDK to:

  • Create a multipart upload
  • Sign each part upload
  • Complete the upload

See Laravel S3 multipart example or AWS docs.


3. Blade View: Add Uppy Dashboard


4. Livewire Integration

  • You can emit a Livewire event from JS when upload completes, passing S3 file keys.
  • Or, have Livewire poll for upload status if needed.

5. References & Further Reading


Summary

  • Use Uppy with the AwsS3Multipart plugin for chunked, direct-to-S3 uploads.
  • Implement 3 Laravel endpoints to handle S3 multipart upload lifecycle.
  • Use Uppy’s Dashboard for drag-and-drop and multiple file support.
  • Notify Livewire when uploads complete.

If you need a sample Laravel controller for the S3 endpoints, let me know!

1 like

Please or to participate in this conversation.