Next.js Application File Storage

Store Files From Server Actions and Route Handlers — Without the Ephemeral Filesystem Trap

Serverless file storage for Next.js with global CDN delivery. Perfect for modern web apps.

Every Next.js app eventually learns the hard way that the runtime filesystem is ephemeral — write a file to disk in an API route on Vercel or any container host and it's gone on the next cold start or deploy. The fix is external storage, and files.link plugs into Next.js exactly where uploads naturally land: Server Actions, Route Handlers, and API routes. The cleanest modern pattern is a Server Action.

The form posts FormData, the action reads the File, converts it to a buffer, and runs the three-call upload server-side — POST /v1/files/{folderId} for a presigned URL and id, PUT the buffer, then POST /v1/files/confirm-upload with { ids: [id] } — using your raw API key from an environment variable that, because it's a Server Action, is never shipped to the client.

Roughly: 'use server'; export async function upload(formData) { const file = formData.get('file'); const buf = Buffer.from(await file.arrayBuffer()); const init = await fetch(\${API}/v1/files/${folderId}\, { method: 'POST', headers: { Authorization: process.env.FILESLINK_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ files: [{ name: file.name }] }) }); const { urls } = await init.json(); await fetch(urls[0].url, { method: 'PUT', body: buf }); await fetch(\${API}/v1/files/confirm-upload\, { method: 'POST', headers: { Authorization: process.env.FILESLINK_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ ids: [urls[0].id] }) }); return urls[0].url; } The identical three calls work from a Route Handler (app/api/upload/route.js) and from a Pages Router API route.

The returned URL drops straight into next/image as the src; files.link serves the image from a global CDN, though it does not do server-side transforms, so use next/image's own resizing/optimization on top for responsive variants. The deliberate contrast with Vercel Blob is portability: Blob is great until you self-host or move off Vercel, at which point you're rewriting your storage layer — files.link runs the same against Vercel, a Node container, AWS, or bare metal, with no platform coupling.

Against Uploadthing you avoid adopting a typed wrapper library and its hosting; against the AWS SDK you skip IAM and bucket setup entirely. Private files (user uploads, gated documents) are stored privately and served through expiring signed URLs your server mints after an auth check. Billing is prepaid credits, not per-request metering, so traffic spikes from a viral page don't translate into a surprise invoice line. Pair with the React and Node.js guides below for full-stack coverage.

Benefits With No Complexity

Global CDN delivery

Your files are served from 450+ edge locations worldwide.

Edge-cached worldwide

Files are cached close to your users for fast delivery.

Signed-URL security

Private files stay protected with time-limited access.

What You Get

Unlimited files

Upload as many files as you need.

Unlimited storage

There is no storage limit.

Public + Private storage

Private files are fully secured.

CDN ready links

Upload directly to 450+ edge locations worldwide.

Prepaid credits

No subscription. Pay only for the storage and bandwidth you use.

More coming soon

We have plenty of features coming!

How files.link Works

1. Upload

Create a project and upload your first file.

2. Copy

Copy the CDN link.

3. Use Anywhere

Paste and enjoy the blazing speed.

Why Developers Choose files.link

A Better Way to Store & Deliver Files

Vercel BlobUploadthingAWS S3 (aws-sdk)files.link
Works on Vercel and self-hosted equally
No platform lock-in
Global CDN (no Blob region limits)
Key stays server-side in Server Actions
Private files via signed URLs
Prepaid credits (no per-request metering)

Calculate Your Needs

Storage

0GB

Egress

0GB

CDN Bandwidth

0GB
Total: $0.000/month

Start Storing Files in Next.js

  • Global CDN delivery
  • Edge-cached worldwide
  • Signed-URL security
  • Unlimited files
  • Unlimited storage
  • Public + Private storage
  • No subscription — prepaid credits keep spend predictable
Start Storing Files in Next.js

Frequently Asked Questions

How do I upload from a Server Action?
Read the File from FormData, convert it to a Buffer, and run the three calls server-side: POST /v1/files/{folderId}, PUT the buffer, POST /v1/files/confirm-upload with the id. Keep the API key in an env var — Server Action code never reaches the client.
Does it work from Route Handlers and API routes?
Yes. The same three-call flow runs from app/api/.../route.js (App Router) and pages/api (Pages Router). The pattern is identical; only where you read the request body differs.
Can I use it with next/image?
Yes. The CDN URL works as a next/image src. files.link doesn't do server-side image transforms, so let next/image handle resizing and responsive variants on top of the CDN-served original.
Why not Vercel Blob?
Blob couples you to Vercel. files.link runs the same on Vercel, a self-hosted container, AWS, or bare metal, so moving hosts doesn't mean rewriting your storage layer. It's also prepaid rather than per-request metered.
How do I handle private user uploads?
Store them as private files. Your server checks the session, then mints an expiring signed URL for the download — the file never sits on a guessable public URL.
General Questions
Is there a subscription?
No. files.link uses prepaid credits, so storage, bandwidth, and API usage are deducted from your balance as you go. The app explains the payment step before uploads are enabled — no monthly subscription and no per-user fees.
What is files.link?
files.link is a developer-first file platform that makes it simple to store, secure, and deliver files globally. It provides signed URLs, public/private access, and an API-first design so you can integrate file delivery into any app without the usual complexity.
How does billing work?
files.link uses prepaid credits. As you use storage, bandwidth, and API requests, credits are deducted daily. When your balance runs low, we automatically recharge it using your saved card. If an auto-recharge doesn't go through, your files and links stay put — you simply update your payment method or top up manually to keep going. No monthly subscriptions — just simple usage-based pricing.
How secure is my data?
All files are encrypted at rest and in transit. You can use signed URLs for private files, control access with permissions, and rely on enterprise-grade infrastructure for data protection.

Related

files.link
Copyright © 2026
All rights reserved
ContactGuidesGlossaryStatusLegal