Hakolkal
Start a Project

Article · Published December 3, 2026

Large file uploads from the browser: straight to storage, not through my server

The obvious way to upload large files from the browser is through your own server, and it is the wrong one: the file travels twice, the server pays for both trips, and a weak connection kills it. Sending the file straight to cloud storage avoids the detour. Here is how Snapstems does it, what my server still controls, and what a resumable upload would still take.

The Snapstems home page, with a waveform dividing into four lines

Why a large file should not pass through your server

Snapstems is my AI stem separator, a paid web app at snapstems.com: drop a song and get the voice, drums and bass back as separate tracks. A song can weigh up to 100 MB there. Sent through my server, each file would be received once, then sent a second time to storage.

It would not even pass. My hosting accepts requests of about 32 MB at most and cuts a forwarded request after about 60 seconds. So the file has to go around the server, and the server's job shrinks to deciding who may upload what.

How the browser uploads straight to cloud storage

The browser first tells my server the file's name, type and size. If the request is acceptable, the server asks Google Cloud Storage to open an upload session for one file, under a random name the server picks, and passes the session's address back to the browser.

The browser then sends the file to that address, and the page shows a progress bar with a percentage. My server never touches the audio. The address only works for that one file, and the storage is set to accept browser uploads from Snapstems' own web addresses.

What the server still controls: who, size and type

Only a signed-in account with credits left gets a session. The file name must end in one of six audio formats, and a declared size above 100 MB is refused before a single byte is sent. In each case the visitor reads why: unsupported type, or file too large.

The browser's word is not trusted. Before a split starts, the server asks the storage for the real size of the file and refuses it if it is over the limit or missing. It also refuses a name that does not have the shape of the ones it issues. Only then is a credit taken.

What happens to the file after the upload

The separation runs on Replicate, a service that hosts AI models, and Replicate fetches the song from the storage itself. When the split is done, my server copies the separated tracks into my own storage, because the links Replicate returns expire after about an hour, and builds a zip.

A storage rule then deletes every file after seven days, the upload and the results alike, so nothing is kept by accident and nothing needs cleaning by hand. A visitor can also skip the upload and paste a direct link to an audio file: Replicate fetches the link.

Where it stops: the page does not resume an upload yet

The session is of the kind Cloud Storage calls resumable, but my page does not resume anything yet: it sends the file in one go. If the connection drops, the visitor reads "Upload failed, check your connection", the file stays selected, and the next try starts from zero. Resuming is still to build on the browser side.

Two more limits. The type check reads the end of the file name, not the content: if the model cannot read the file, the split fails and the credit comes back. And small files need none of this. In Fashnable, my AI virtual try-on for online stores, photos pass through the server, which checks and shrinks them.

What to decide before accepting large file uploads

Three decisions. What is the largest file you accept: the cap sets your worst cost per upload, and whether resuming is worth building. How long are files kept: seven days, a year, until the user deletes them? And what does the user see when the connection drops: an error and a restart, or a quiet resume?

I ask these before choosing a storage service, because the answers shape the design more than the tools do. For files in the gigabytes I would build the resume step first. If your product has to receive video, audio or archives from its users, tell me the sizes and I will say what I would build.

Want something like this?

Tell me what you are building, or what you are still doing by hand, and I will tell you how I would approach it. No commitment.