Guide

Upload large files that survive a dropped connection

Send big videos and archives in parts, retried part by part, and carry on after a crash or a reload instead of starting again.

Uploads guide · in this guide

  • Why big uploads fail
  • What you would have to build
  • 1. In the browser: turn on resumable
  • 2. From a server: uploadInParts
  • What you get at the end

Published · Updated

Why big uploads fail

A 2 GB video in one request is a long, fragile thing. On a train, a phone or a busy office network, one blip near the end and the browser starts again from zero. Servers in the middle add their own timeouts and body limits, and if the bytes pass through your API they tie up a process for as long as the upload takes.

The fix every large-file service uses is the same idea: split the file into parts, send each part on its own (a few at once), retry only the part that failed, and keep track of which parts arrived so the upload can carry on later. S3 multipart uploads, the tus protocol and Mux direct uploads all work this way.

What you would have to build

  • An endpoint that starts a multipart upload at your storage and checks the user may upload a file that big.
  • Short-lived, presigned URLs for each part, so the browser sends bytes straight to storage and not through your server.
  • Storage CORS rules so the browser can PUT to the bucket and read each part's ETag.
  • Somewhere to remember the upload id across a reload, and an endpoint that lists the parts storage already has.
  • A finish step that joins the parts and then does everything a normal upload does: check the size and type, hash it, record it.
  • A sweep that aborts uploads people walked away from, or you pay to store their parts forever.

Fileboy's upload sessions are that list, done. The libraries handle the parts, retries and resume for you.

1. In the browser: turn on resumable

Give the uploader resumable. Files of 50 MiB and up go in parts (four at a time), each part is retried with backoff, and the session id is kept in localStorage, so choosing the same file again after a crash or a reload carries on from the parts already sent. Smaller files go in one request as before.

import { FileboyProvider, MultiFileUploader } from "@cd2/fileboy-react"

export function App() {
  return (
    <FileboyProvider publicKey="YOUR_PUBLIC_KEY">
      <MultiFileUploader resumable allow="video/*" onFilesUploaded={files => console.log(files)} />
    </FileboyProvider>
  )
}

For your own progress bar and a pause button, use createResumableUpload, which has pause(), resume() and abort():

const fileboy = useFileboy()
const upload = fileboy.createResumableUpload(file, {
  folderPath: "/recordings",
  onProgress: ({ loaded, total }) => setPercent(Math.round((loaded / total) * 100)),
})
const { file: saved } = await upload.start()
console.log(saved.id, saved.hash)

2. From a server: uploadInParts

From Node, uploadInParts takes a file path, a Buffer or a stream (with its size). Keep the session id it gives you; if the process dies, pass it back and only the missing parts are sent.

import { Fileboy } from "@cd2/fileboy-node"

const fileboy = Fileboy({ publicKey: process.env.FILEBOY_PUBLIC_KEY!, privateKey: process.env.FILEBOY_PRIVATE_KEY! })

let sessionId: string | undefined
const session = await fileboy.uploadInParts("./backup-2026-11.tar.gz", {
  folderPath: "/backups",
  onSession: s => (sessionId = s.id),
})
console.log(session.file!.id)

// Later, after a crash:
await fileboy.uploadInParts("./backup-2026-11.tar.gz", { sessionId })

Python, Ruby and PHP have upload_in_parts / uploadInParts too, with an on_session / onSession callback that gives you the session id to keep. Add kind: "video" to make a video, which is processed for streaming once it completes.

What you get at the end

A completed session is a normal Fileboy file: its type is told from its bytes, its SHA-1 hash is worked out from every byte, images get their size and EXIF data, it lands in its folder with its metadata, and your file.uploaded webhook fires. Uploads are still held to your plan's upload cap and storage limit, and an upload in progress reserves its size, so several at once can't overshoot.

Sessions last 24 hours. An upload left longer than that has its parts thrown away, and starts again.

Checked against the current libraries in November 2026. Found something that no longer works? Tell us.

Still choosing a tool?

Fileboy is small on purpose. This comparison says where it fits and where another option is the better call.

Get a key and run this code

Create a free app, copy your keys into the example and run it. The free plan needs no card.