In this episode, we're kicking off chunked file uploads! We start by discussing all the different ways to handle chunked uploads and land on using the Upchunk package, which makes the client-side chunking super easy.
We run through installing Upchunk via npm and get it set up to send files to our backend. We also create a very basic Laravel controller and endpoint to receive the uploads—though we don’t actually handle the uploaded chunks just yet. At this stage, we just want to confirm the data is being sent and received.
There’s some nuance here, especially because Upchunk doesn’t use Axios under the hood. This means things like CSRF tokens won’t automatically get included in our requests. So, we include a little walkthrough on how to grab the CSRF token from Laravel and add it to your headers, making sure those chunked requests don’t get rejected (no more 419 errors!).
Finally, we do a quick test upload, see the chunks hitting our backend, and stash the uploader state so we can improve on it later. We leave things set up nicely—ready to handle the backend processing and storage in future episodes. So, by the end of this episode, you'll have chunked uploads firing off from the client and being picked up server-side!