menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Uploading ...
source image

Dev

1M

read

414

img
dot

Image Credit: Dev

Uploading Files to Cloudflare R2 from the Frontend (No Axios Needed!)

  • Building a file upload feature for your web app without using a backend by uploading files directly to Cloudflare R2 using a pre-signed URL and plain fetch.
  • Step 1: Generate a Signed Upload URL on the Server to avoid exposing R2 credentials on the frontend.
  • Step 2: Upload from the Frontend using Fetch with a minimal example of HTML file input and plain JavaScript for faster and secure file uploads straight to Cloudflare.
  • Make sure your R2 bucket has CORS enabled for PUT requests to ensure smooth functionality.

Read Full Article

like

24 Likes

For uninterrupted reading, download the app