DEV Community

Ihor Ko
Ihor Ko

Posted on

How I Built a Simple File Sharing Tool Using Cloudflare R2 (No Login, Fast Uploads)

File72 Main Page Share File Online

I wanted a simple way to send files to friends and clients.

No accounts. No friction. Just upload -> get a link -> share.

Most tools I tried either required signup, had limits, or felt too heavy for quick file sharing. So I built my own.

Goal

The idea was simple:

Upload a file instantly
Generate a shareable link
No login required
Auto-delete after expiration
Keep it fast and minimal

Tech Stack

Here’s what I used:

Frontend: React + Vite
Backend: Cloudflare Workers
Storage: Cloudflare R2
CDN: Cloudflare (global edge)

Why Cloudflare R2?

R2 was perfect because:

No egress fees
Works natively with Workers
Fast global access
Simple object storage

Upload Flow

The upload process is handled entirely via a Worker:

User selects a file
Frontend sends POST /upload
Worker generates a unique ID
File is stored in R2
Metadata is saved (name, size, expiration)
A shareable link is returned

Example response:

{
"id": "AbC123xyz",
"file_url": "/AbC123xyz",
"expires_at": "2026-05-10T12:00:00Z"
}

Generating Safe IDs

I avoided confusing characters like 0/O or l/I.

const alphabet = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789';
Enter fullscreen mode Exit fullscreen mode

This reduces user errors when sharing links.

Storing Files in R2

Inside the Worker:

await env.FILE72_BUCKET.put(id, request.body, {
httpMetadata: {
contentType: request.headers.get("content-type"),
},
customMetadata: {
fileName,
createdAt,
expiresAt,
}
});

Serving Files

Downloads are handled via:

GET /file/{id}

The Worker:

fetches from R2
returns the file stream
applies proper headers

Expiration Logic

Each file has:

createdAt
expiresAt

Cleanup can be handled via:

scheduled Worker (cron)
or lazy deletion on access

What I Learned

Simplicity wins - users don’t want accounts for quick tasks
Edge compute (Workers) is insanely fast
R2 is a great alternative to S3 for this use case
Most file sharing tools are overbuilt

Live Example

If you’re curious, I deployed it here:

https://file72.com

It’s a simple, but it works well me.

Feedback Welcome

If you’ve built something similar or have ideas to improve it, I’d love to hear your thoughts.

File72 Uploading Page - Upload File Online
File72 File Uploaded Page Upload File Instantly Free

Top comments (0)